Click here to Skip to main content
15,919,132 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: print current screen in c++ Pin
George L. Jackson21-Feb-06 13:36
George L. Jackson21-Feb-06 13:36 
QuestionPrinting using printdialog / printDocument HELP needed! Pin
ArianN20-Feb-06 15:36
ArianN20-Feb-06 15:36 
QuestionAuthentication Daemon in C/C++ Pin
Blessed_2320-Feb-06 12:07
Blessed_2320-Feb-06 12:07 
QuestionCreating a simple multi threaded server.. Pin
maluguy20-Feb-06 7:15
maluguy20-Feb-06 7:15 
Questionstruct problem Pin
super_pointer19-Feb-06 3:48
super_pointer19-Feb-06 3:48 
AnswerRe: struct problem Pin
George L. Jackson19-Feb-06 6:11
George L. Jackson19-Feb-06 6:11 
AnswerRe: struct problem Pin
George L. Jackson19-Feb-06 7:33
George L. Jackson19-Feb-06 7:33 
QuestionMessage Only Window Error Pin
Peter Charlesworth19-Feb-06 2:57
Peter Charlesworth19-Feb-06 2:57 
Hi!

I'm currently trying to get a program working that's supposed to display only a message
meaning without a window.
I've retrieved from various locations source code for this but every time there's
at least one error in the compile.
I'm using Borland C++ 5.5 as my compiler in a DOS-environment.
This is the source of the code that isn't working:

<br />
msgonly.cpp:<br />
<br />
#include <windows.h><br />
<br />
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);<br />
<br />
int APIENTRY WinMain(HINSTANCE hInstance,<br />
HINSTANCE hPrevInstance,<br />
LPSTR lpCmdLine,<br />
int nCmdShow)<br />
{<br />
	MSG msg; // MSG structure to store messages<br />
	WNDCLASSEX wcx; // WINDOW class information<br />
<br />
	// Initialize the struct to zero<br />
	ZeroMemory(&wcx,sizeof(WNDCLASSEX));<br />
	wcx.cbSize = sizeof(WNDCLASSEX); // Must always be sizeof(WNDCLASSEX)<br />
	wcx.style = NULL;<br />
	wcx.lpfnWndProc = (WNDPROC)MainWndProc; // Pointer to the callback procedure<br />
	wcx.cbClsExtra = 0; // Extra byte to allocate following the wndclassex structure<br />
	wcx.cbWndExtra = 0; // Extra byte to allocate following an instance of the structure<br />
	wcx.hInstance = hInstance; // Instance of the application<br />
	wcx.hIcon = NULL; // Class Icon<br />
	wcx.hCursor = NULL; <br />
	wcx.hbrBackground = NULL;<br />
	wcx.lpszMenuName = NULL; // Menu resource<br />
	wcx.lpszClassName = "MessageOnly"; // Name of this class<br />
	wcx.hIconSm = NULL; // Small icon for this class<br />
<br />
	// Register this window class with MS-Windows<br />
	if (!RegisterClassEx(&wcx))<br />
	return 0;<br />
<br />
	// Create the window<br />
	hwndMain = CreateWindowEx(WS_EX_LEFT, <br />
	"MessageOnly", // Window class name<br />
	NULL, // Window title<br />
	0, // Window style<br />
	0, // (x,y) pos of the window<br />
	0, // Width and height of the window<br />
	0, // HWND of the parent window (can be null also)<br />
	0, // Handle to menu<br />
	HWND_MESSAGE, // Make this window-less.<br />
	0, // Pointer to window creation data<br />
	hInstance,<br />
	0);<br />
<br />
	// Check if window creation was successful<br />
	if (!hwndMain)<br />
	return 0;<br />
<br />
	// Make the window visible<br />
	ShowWindow(hwndMain,SW_SHOW);<br />
	// Process messages coming to this window<br />
	while (GetMessage(&msg,NULL,0,0))<br />
	{<br />
		TranslateMessage(&msg);<br />
		DispatchMessage(&msg);<br />
	}<br />
<br />
	// return value to the system<br />
	return 0;<br />
}<br />
<br />
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)<br />
{<br />
	switch (msg)<br />
	{<br />
		case WM_DESTROY:<br />
		// User closed the window<br />
		PostQuitMessage(0);<br />
		break;<br />
		default:<br />
		// Call the default window handler<br />
		return DefWindowProc(hwnd,msg,wParam,lParam);<br />
	}<br />
	return 0;<br />
}<br />


This is the error I get:

<br />
Error E2451 msgonly.cpp 33: Undefined symbol 'hwndMain' in function __stdcall WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int)<br />


Can anyone help me with this? Confused | :confused:

Thanks!
AnswerRe: Message Only Window Error Pin
Peter Charlesworth19-Feb-06 2:59
Peter Charlesworth19-Feb-06 2:59 
AnswerRe: Message Only Window Error Pin
mbue19-Feb-06 12:18
mbue19-Feb-06 12:18 
GeneralRe: Message Only Window Error Pin
Peter Charlesworth20-Feb-06 6:47
Peter Charlesworth20-Feb-06 6:47 
QuestionPrint Combinations Pin
RockyJames18-Feb-06 9:48
RockyJames18-Feb-06 9:48 
AnswerRe: Print Combinations Pin
Michael Dunn18-Feb-06 11:18
sitebuilderMichael Dunn18-Feb-06 11:18 
AnswerRe: Print Combinations Pin
willbetter22-Feb-06 15:39
willbetter22-Feb-06 15:39 
Questionsrand( ) function Pin
chrizpl17-Feb-06 23:10
chrizpl17-Feb-06 23:10 
AnswerRe: srand( ) function Pin
George L. Jackson18-Feb-06 1:12
George L. Jackson18-Feb-06 1:12 
GeneralRe: srand( ) function Pin
chrizpl18-Feb-06 1:49
chrizpl18-Feb-06 1:49 
GeneralRe: srand( ) function Pin
George L. Jackson18-Feb-06 2:46
George L. Jackson18-Feb-06 2:46 
QuestionSpanning Tree Algorithm Implementation Pin
techno_brains17-Feb-06 4:30
techno_brains17-Feb-06 4:30 
AnswerRe: Spanning Tree Algorithm Implementation Pin
Cedric Moonen17-Feb-06 9:30
Cedric Moonen17-Feb-06 9:30 
AnswerRe: Spanning Tree Algorithm Implementation Pin
George L. Jackson17-Feb-06 12:07
George L. Jackson17-Feb-06 12:07 
QuestionGetting a list of controls from another process (application) Pin
Virtek17-Feb-06 3:21
Virtek17-Feb-06 3:21 
AnswerRe: Getting a list of controls from another process (application) Pin
Virtek17-Feb-06 7:38
Virtek17-Feb-06 7:38 
QuestionNumbering Puzzle in C++ Pin
chrizpl17-Feb-06 1:47
chrizpl17-Feb-06 1:47 
AnswerRe: Numbering Puzzle in C++ Pin
toxcct17-Feb-06 1:51
toxcct17-Feb-06 1:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.