Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-21-2006, 10:13 PM   #1 (permalink)
Redline
PHP Student
 
Join Date: Oct 2004
Location: Forest Grove, OR
Posts: 151
Redline is on a distinguished road
Send a message via AIM to Redline Send a message via MSN to Redline
Help with simple error

I haven't done much with C, and what I have done hasn't tied into any window handles or processes. I'd like to build a socket based remote control plugin for winamp. For starters though, I'd like to just be able to compile, and get the winamp handle through FindWindow (and I don't even know where FindWindow belongs, I'm assuming it's from the windows.h header).

Here's the code I'm trying to compile

Code:
#include <stdafx.h>
#include <windows.h>
#include <process.h>
#include <wa_ipc.h>


int main()
{
  HWND hwnd_winamp;
  hwnd_winamp = FindWindow("Winamp",NULL);

  return 0;
}
And the error

Quote:
1>------ Build started: Project: war, Configuration: Debug Win32 ------
1>Compiling...
1>war.cpp
1>Linking...
1>war.obj : error LNK2019: unresolved external symbol __imp__FindWindowA@8 referenced in function _main
1>C:\Documents and Settings\Josh\My Documents\Visual Studio 2005\Projects\war\Debug\war.exe : fatal error LNK1120: 1 unresolved externals
__________________
Current Project
Redline is offline   Reply With Quote
Old 06-22-2006, 12:23 AM   #2 (permalink)
QUantumAnenome
Code Monkey
 
Join Date: Mar 2005
Posts: 56
QUantumAnenome is on a distinguished road
Send a message via Yahoo to QUantumAnenome
It works fine if you start with a simple win32 app. It does not work, however, when you start with a console app.
QUantumAnenome is offline   Reply With Quote
Old 06-22-2006, 12:33 AM   #3 (permalink)
Redline
PHP Student
 
Join Date: Oct 2004
Location: Forest Grove, OR
Posts: 151
Redline is on a distinguished road
Send a message via AIM to Redline Send a message via MSN to Redline
That makes sense, but when I go to create a new project, the only option I have under Win32, is a Win32 console app. I'm sure I'm doing something wrong. Could it be that I'm using the time-trial version of VC++ express?
__________________
Current Project
Redline is offline   Reply With Quote
Old 06-22-2006, 12:44 AM   #4 (permalink)
QUantumAnenome
Code Monkey
 
Join Date: Mar 2005
Posts: 56
QUantumAnenome is on a distinguished road
Send a message via Yahoo to QUantumAnenome
Could be, I'm not sure as I have .net 2003 version. Here is a snippet from the MSDN help page:

CWnd::FindWindow
Microsoft Windows® 95 or later: FindWindowW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
Header: Declared in Winuser.h, include Windows.h
Import library: User32.lib

Good luck, as it will be difficult to do things easily in windows when starting with a console app.
QUantumAnenome is offline   Reply With Quote
Old 06-22-2006, 12:47 AM   #5 (permalink)
QUantumAnenome
Code Monkey
 
Join Date: Mar 2005
Posts: 56
QUantumAnenome is on a distinguished road
Send a message via Yahoo to QUantumAnenome
Well, it compiled when I added user32.lib to the linker inputs, started with a console app.

Code:
#include "stdafx.h"
#include <windows.h>

int _tmain(int argc, _TCHAR* argv[])
{
	FindWindow(NULL, NULL);
	return 0;
}
QUantumAnenome is offline   Reply With Quote
Old 06-22-2006, 01:38 AM   #6 (permalink)
Redline
PHP Student
 
Join Date: Oct 2004
Location: Forest Grove, OR
Posts: 151
Redline is on a distinguished road
Send a message via AIM to Redline Send a message via MSN to Redline
Ahh! That's it! I knew there was a lib I needed to include. Thank you I'm sure I'll run into more problems, but at least it compiles now
__________________
Current Project
Redline is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse Error with "else" in simple game. slashdot Standard C, C++ 7 07-20-2005 08:13 AM
What is this error? john_tran Standard C, C++ 4 10-20-2004 08:30 PM


All times are GMT -8. The time now is 09:35 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting