|
Thanks for your answer Michael, i updated the original message before i readed your reply (i guess i was updating it while you were adding the reply , i would appreciate if you read the update and tell me what you think about using #define
|
|
|
|
|
That's still not exactly right. You don't initialize global variables in the header file, but in the .cpp file where they are defined.
appconsts.h:
extern TCHAR* FOO;
appconsts.cpp:
TCHAR* FOO = _T("Hello");
The Windows headers use #define because the API is still a C interface, and const is not supported by all C compilers (it was officially added to C rather recently).
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
Thanks Mike
|
|
|
|
|
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.
|
|
|
|