|
I need source code to a program that copies itself into a certain directory like "C:\Program Files" and I want it to have a list of certain names. I got this so far:
void main()
{
char *filenames[] = {"information.exe", "test.exe", "testing.exe"
};
LPCTSTR Destination = ("C:\\Program Files\\");
CopyFile(ModuleFileName, Destination);
}
but I don't know how to copy itself as those filenames.
-Ryan M.
|
|
|
|
|
Sounds like a really amateur virus
Anyway You should issue a call for each name in the filenames
and your void main shouldn't end with a ;
to copy a file you have several options:
i would go for a while (fread()) fwrite style
or even an assembly copy
|
|
|
|
|
Inorder to catch WM_LBUTTTONDBLCLK in MDIClient area I do that:
1.
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
if( !CMDIFrameWnd::PreCreateWindow(cs) )<br />
return FALSE;<br />
return TRUE;<br />
}
added
cs.style|=CS_DBLCLKS;//to response DoubleClick
2.reload PreTranslateMessage(MSG* pMsg)Function:
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) <br />
{<br />
<br />
<br />
if(pMsg->hwnd==m_hWndMDIClient && pMsg->message==WM_LBUTTONDBLCLK)<br />
PostMessage(WM_LBUTTONDBLCLK);<br />
return CMDIFrameWnd::PreTranslateMessage(pMsg);<br />
}
3.in CMainFrame add
WM_LBUTTONDOWN AND WM_LBUTTONDBLCLK Message_map:
void CMainFrame::OnLButtonDown(UINT nFlags, CPoint point) <br />
{<br />
AfxMessageBox("Left Mouse Down!");<br />
CMDIFrameWnd::OnLButtonDblClk(nFlags, point);<br />
}<br />
void CMainFrame::OnLButtonDblClk(UINT nFlags, CPoint point) <br />
{<br />
AfxMessageBox("Left Mouse DoubleClicked!");<br />
CMDIFrameWnd::OnLButtonDblClk(nFlags, point);<br />
}
:(but all that did'nt work,none messagebox OUT!!
WHY ??????
i wanna learn more @_@!
|
|
|
|
|
Pls help me !
Is there anyone can help me?
sos!!
i wanna learn more @_@!
|
|
|
|
|
If I have a simple program that multiplies a user specified number of integers, how can I get the program to generate the same amount of corresponding, integer data type variables? Or, better said, how do you create null variables during runtime?
|
|
|
|
|
|
I have a class (Named CData), that I want to load up using serveral different dialogs that are launched from CMainFrame.(menu)
The gathered data determines where I proceed in the program. How do I do this with a "un-MFC" class?
Programming! - Isn't it Great!
See you in CyberSpace!
|
|
|
|
|
I know this is easy, but its annoying. I"m trying to a value from within a byte array that I need to cast into a short. Here's what I have and its not working.
short *pnMsgType;
short nMsgType;
int pos = sizeof(FrameHdr) + 1;
pnMsgType = (short *) (&pMsgBuffer + pos);
memcpy (&pnMsgType, (short *) (&pMsgBuffer + pos), sizeof (nMsgType));
Neither the assignment statement or the memcpy is getting me the 2 bytes I need at the position. Any ideas??
-C
|
|
|
|
|
Never mind.. I fixed it, I didnt need the "&" in pMsgBuffer in the assignment statement.
-C
|
|
|
|
|
Hello,
I've an OCX written in MFC, and am trying to use it from a VB Client.
To be able to PostMessage() within my control I need the HWND . Any VB client (as per info on the net), does not support HWND for OLE Controls (my OCX is one!).
My control's "this " has the "hWnd " as 0x00000000 when I use the OCX from a VB Client!
But it properly works from the ActiveX Test Container, or from a VC++ client.
Is this correctable, or am I doing anything wrong?
Thanks,
Rgds,
Nirav Doshi
|
|
|
|
|
if you want HWND to control then use HWND hWnd = GetSafeHwnd();
if you want handle to container use
HWND m_hwndContainer = GetParent()->GetSafeHwnd();
|
|
|
|
|
Pradeep Maskeri wrote:
HWND m_hwndContainer = GetParent()->GetSafeHwnd();
Thanks Pradeep for your reply... But I had already tried this, without help!
* Don't wish it was easier, wish you were better! *
|
|
|
|
|
Hi.
I am taking my first programming class and I am trying to write a sample void function. Would anyone be willing to show me what I am doing wrong? Here is what I have so far:
#include <iostream>
using namespace std;
void GetNumbers(int&, int&, int&);
int main ()
{
int a;
int b;
int c;
int average;
GetNumbers (a,b,c);
average=(a+b+c)/3;
cout << "The average of your numbers is"<< average << endl;
}
Void GetNumbers(int& firstnumber, int& secondnumber, int& thirdnumber)
{
cout<< "enter three numbers" <<endl;
cin>>firstnumber>>secondnumber>>thirdnumber;
}
|
|
|
|
|
umm... you have a capital on Void in the definition of GetNumbers?
|
|
|
|
|
Thank you. Sorry for the dumb question. Like I said, I am very new to this.
|
|
|
|
|
It would help to know what the output is, but (a+b+c)/3 is integer arithmetic and the decimal part of the answer will be truncated. Try using "float"s instead of "int"s
The maximum characters for the signature is five hundred. I was wondering how long a five hundred characters message would be, so I decided to make my signature 500 characters long. I'm sure if I had some cool html stuff in my signature, I could eat up five hundred characters, but just typing five hundred characters takes quite some time. The trick I think is finding something to say, but I'm usually a man of few words. So I guess I'll tell you what I've discovered is the secret to life. It
|
|
|
|
|
Thank you, I included float and it works much better.
|
|
|
|
|
maybe you should try acquiring each number one at a time within your void function. Also, what are you including?
|
|
|
|
|
I really appreciate the tip. I put using std because I don't know when not to use it , so I just put it in.
|
|
|
|
|
I'm writing an activex, and I need a method that return 3 values, (a string and 2 longs).
I will use the activex in Visual Basic.
What kind of return should I use?.
Could I return an object?.
if I can, how I do that?.
Any other idea??
Thank you.
|
|
|
|
|
this URL might help http://www.kbalertz.com/Feedback_177218.aspx
|
|
|
|
|
Hello. I once saw a piece of code, which used fprintf instead of send(), to send data via winsock. How can I "convert" my socket-handle into a file-handle, usable in the fprintf-function ?
Thank you.
|
|
|
|
|
Does anybody know of any utilities that can be used to convert from Borland C++ Builder 1.0-3.0 to Visual C++ 6.0/.Net. The company I work for has many products that must be upgraded. I hate to start from scratch if not necessary. Thanks for any info.
Bill Miller
|
|
|
|
|
I know of no utilities, but would advise you to create the VS projects/solutions from scratch even if there were. In the past I've done way to many cross compiler "ports" (and even backward ports from VS 4/5/6 to VC++ 1.52c and even a "port" from OWL to MFC.)
The OWL to MFC port was the most difficult, especially since at the time, MFC didn't support reflection but OWL did. (For the record, everything else was easier in MFC and Visual C++ 1.52c was much more stable.)
If you need assistance, I'm available for moonlighting.... (I'm one of those sickos who actually likes doing this, within reason [like my current job where we're just holding our collective noses and sticking with the convoluted combination of C, C++, MFC, STL, rolled-their-own-bizarro-partial-clone-of-ATL and mystery code.])
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi Joe,
Thanks for replying so quickly. I will pass your suggestions along to the powers that be, and will keep you in mind. have a good weekend.
|
|
|
|