|
If I understand the question correctly...
As far as I know ... Yes it is possible.
I mean everytime you install something from a CD, the application your installing performs these actions...
Only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
yes it is possible, just the same as you would with any other exe. But if you are running software from a CD, you need to make sure it doesn't require the use of it's current directory for any temp files or writing operations.
You may also want to use an 'autorun' file, which would enable your user to run the exe without double clicking it.
|
|
|
|
|
The answer to your question is yes: you can program a virus which is distributed on CD and messes around whith the user file system automatically when it is inserted.
... and there are special locations to where you can write files that will execute automatically whenever the user's computer boots!
Isn't it wonderful? The extraordinary things one can do with computers??
:-P
Rilhas
|
|
|
|
|
I have written a Mesage Handler function ,which handles a user defined message. This function is not called for the first time when a button is clicked while it is called at all other times after clicking it for the first time. This happens in case of Windows 98 only while it runs fine on NT.
|
|
|
|
|
Can you please show me that function declaration and defenition
RinuRaj
|
|
|
|
|
chakor123 wrote: which handles a user defined message
If its a user defined message, how it's getting called on button click.
Do you mean to say , you have written message handler for button click?
Can you provide some more info? like,how its created, is it on dialog , etc?
|
|
|
|
|
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
|
|
|
|