|
This is what i have written.
ON_MESSAGE( WM_REMIND_REGISTER_REAL, OnRemindRegisterRealOk )
afx_msg LRESULT OnRemindRegisterRealOk( WPARAM wParam, LPARAM lParam );
LRESULT CLobbyDlg::OnRemindRegisterRealOk( WPARAM wParam, LPARAM lParam )
{
if( (BOOL)lParam == TRUE )
{
// set up real money account
OnBtnCashierSetup();
}
return 0;
}
|
|
|
|
|
but OnRemindRegisterRealOk , will be called when you use SendMessage/PostMessage for this dialog( using message WM_REMIND_REGISTER_REAL).
How does it related to get called on button click? I think OnBtnCashierSetup is you button click handler.
|
|
|
|
|
Both new and malloc() are pretty much covered, buth I can find nothing about the other memory manipulation functions. What is the difference between CopyMemory() and memcpy() , is one safer than the other? Is one faster? Will one pay me if I use it?
|
|
|
|
|
Hi,
MemoryCopy() :
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/copymemory.asp">http:
memcpy() :
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_crt_memcpy.asp">http:
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_memcpy.asp">http:
Only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Well thankyou for the very useful links, but I already know what the functions do and how to use them. My question was "what is the difference between them?"
|
|
|
|
|
|
|
Thankyou, that answered my question exactly. So CopyMemory() is not a function at all, learn something new everyday.
|
|
|
|
|
waldermort wrote: What is the difference between CopyMemory() and memcpy()...
Check out line 103 of winbase.h and line 8344 of winnt.h .
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello,
I have insert only 2 column into my CListCtrl and I want only see those columns. There is allway at the right from the inserted column other column , without titel.
How to show only column that I have inserted ?
Same question for the line, how to see only some lines.
Thank you !
AutreChien
|
|
|
|
|
|
How to insert column and how to set LVCOLUMN for ListCtrl?
|
|
|
|
|
Are you sure it's a third column, or just unused space in the header control?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi
This is code:
<br />
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)<br />
{<br />
switch(msg)<br />
{<br />
case WM_CLOSE:<br />
DestroyWindow(hwnd);<br />
break;<br />
case WM_DESTROY:<br />
PostQuitMessage(0);<br />
break;<br />
default:<br />
return DefWindowProc(hwnd, msg, wParam, lParam);<br />
}<br />
return 0;<br />
}<br />
Here if ichange WndProc name to for example A it can be compiled(also i changed wc.lpfnWndProc = A;)
But if i change its parameters is gives me an error:
error C2440: '=' : cannot convert from 'LRESULT (__stdcall *)(HWND,UINT,WPARAM)' to 'WNDPROC'
for wc.lpfnWndProc = WndProc; line
So i want to ask
why do i obey this parameters rule?I completely define a function.So why windows force me to write standart parameter list.
Also i want to learn what callback is.I heard that callback function is called by windows when event is occured.Is this true?In C# we write a fuction and add to its event with its delegate(function pointer).So windows can call it.
this.button1.Click += new System.EventHandler(this.button1_Click);
button1_Click func. is called when button1.Click event is occured.
But here something different.GetMessage function takes mesg from msg queue.And calls to windproc.So windows doesn't call to callback function.My program itself calls to my callback function.So why is it callback?
Am i wrong?
I confused a lot.
Can you please explain me parameters rules and callback questions.
Thanks
Full code: http://www.winprog.org/tutorial/simple_window.html
|
|
|
|
|
sawerr wrote: why do i obey this parameters rule?I completely define a function.So why windows force me to write standart parameter list.
Because it hase to follow a specific prototype. To be able to 'register' your function, its address (so the function pointer) will be saved in a 'variable'. This variable is in fact defined and so your functino needs to match with the correct argument list.
|
|
|
|
|
sawerr wrote: Also i want to learn what callback is.I heard that callback function is called by windows when event is occured.Is this true?
A callback is like an auto redial on your telephone. Each time something happens, a timer has looped, a specific message is sent... The callback function is called.
sawerr wrote: So i want to ask
why do i obey this parameters rule?I completely define a function.So why windows force me to write standart parameter list.
I you take away digits from a phone number, how can your auto redial work? The same applies here.
Renaming the function is just like a speed dial, 1 for your mother, 2 for the bar. The telephone still dials the correct number.
|
|
|
|
|
waldermort wrote: I you take away digits from a phone number, how can your auto redial work? The same applies here.
Renaming the function is just like a speed dial, 1 for your mother, 2 for the bar. The telephone still dials the correct number.
Err, this is quite confusing...
|
|
|
|
|
Thanks or all answers
waldermort wrote: A callback is like an auto redial on your telephone. Each time something happens, a timer has looped, a specific message is sent... The callback function is called.
But i want to learn its mechanism.I explained how i imagine it in C#.I wrote function, I register it with its delagate.And when event occurs "windows" call my function.
But in win32 i wrote in WinMain GetMessage().So it takes message feom queue and call specific func.So function is called my program itself not by windows.
Is this true?If true this is not callback right?If wrong what is the mechanism of win32 callback.I hope i can explain my problem more clear now.
Thanks
|
|
|
|
|
Using GetMessage() is similar to a callback, but by definition it is not. When using a callback function, you first create the function, then pass a pointer for it to another function. For example SetTimer() . The last paramater of SetTimer() allows you to enter a pointer to a function, so each time an event happens (you timer finishes counting) it calls the function.
What you have created is a 'message trap'. When a certain message is there you call your own function.
If you have a user defined message, why don't you just add a handler for it in your WndProc() ? When using GetMessage() and PeekMessage() it is usually to perform an action before the message is processed. For example, trapping keyboard key presses.
-- modified at 4:14 Thursday 7th September, 2006
|
|
|
|
|
I think the main problem you have is to understand WHO calls the Callbackfunction. You give the pointer to a function to windows and Windows will call this function when it gets a message for that window (or did you implement you own GetMessage, TranslateMessage and DispatchMessage functions?)
The usual way to program it is having the loop in WinMain repeat GetMessage TranslateMessage and DispatchMessage calls these functions get one message from the global queue, translate it to make something useful with it and call the WndProc. And exactly that call cannot be influenced by you, it is programmed in the Windows API.
Giving the function pointer at registering is like telling a friend "if anything happens send a mail to this address". When you alter the signature of the function (by changing count, type or order of the parameters) this function is definitely not of the same type that Windows can call as Windows needs a function with 4 parameters. It's comparable like giving out a mobile phone number instead of the expected email adress.
I don't know C#, but i I think there too exist rules for defining event routines, so I don't think you can assign a function that needs 5 arguments to a button click event, or can you do that?
Greetings
Martin Dietz
|
|
|
|
|
I need to call a console application passing it information via CLI.
How is that data passed in? I know it's retreived through args, argc...
Are they internally stored in environment variables? or passed in using streams???
Most Importantly:
=================
Whats the buffer capacity when using the command line? Could I pass buffers as large as 10MB or so using the CLI?
Storing the data in a file and opening that file isn't an option...I need actually pass X number of bytes via the command line. Or a process which is cross platform friendly (Windows/Linux)
Cheers
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
The strings are passed in as char*, basic c type strings. I remember reading somewhere about a 1024 byte limit on the command line, but I cannot find anything on MSDN to support this, so I may be wrong.
I really wouldn't pass a 10mb like this though. Why is using a file not an option? Why don't you look at memory mapped files, which can use the system pagefile, though the calling format is different on linux.
|
|
|
|
|
It's hard to explain why files are not allowed, but basically it's because the caller is written in PHP, executed on linux. PHP has to pass a variable data input, which I would have to first create some randomized file name, worry about file locking, etc...
It'd be much easier to just pass in a buffer. :P
I'll have to re-examine the situtation I guess...as I was sure there was a limit on CLI buffer sizes
Cheers
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
|
I think he meant Command Line Interface, not C++/CLI
|
|
|
|