|
Try This:
CFormatname(CString name,CWnd* pParent = NULL); // standard constructor
Shenthil
|
|
|
|
|
I have been using the introductory edition of MS VC++ 6.0 that came with Ivor Hortons book. What is the current latest version?
Ger
|
|
|
|
|
VC++ .NET 2003
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
In a library that I downloaded I get an error on this line:
#if WIN32 && defined(_MSC_VER) && DEBUG
The sample app that came with the library compiles fine but when I use the library in my app it fails. I belive VC define those variables. So, its probably a configuration thing that I'm missing. (I compiled both projects in the Debug Configuration.)
Thanks for any ideas,
Albert
|
|
|
|
|
AFAIK it is complaining about DEBUG. VC defines _DEBUG (note the underscore). maybe the library or sample supplied defines DEBUG itself?
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks, that was it. DEBUG was defined in the sample program's project.
|
|
|
|
|
I was wondering if there is a way to set the timeout for connecting? My app directly calls connect and if the server is OK then it will connect alright. If for example the address is wrong and it does not connect, it will hang there for many seconds.
One more thing, I am using WSAevents to signal read and etc. This is fine for me. However, I have a problem with using shutdown. It does not gracefully call the FD_CLOSE so that I can formally call closesocket. Has anyone seen this problem?
THanks in advance!
|
|
|
|
|
I have a class derived from CToolBar in a CFrame window. My problem is that I don't know how to tell if the user has closed the toolbar with the close button while it is floating. I have tried providing a OnClose message handler but it never gets called.
Any help would be greatly appreciated.
Thanks in advance.
|
|
|
|
|
Maybe handle the WM_SYSCOMMAND message, looking for the SC_CLOSE command.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Hi guys.
I want to draw in layers, so if anybody could give me a hint about that, I would really appreciate it. I want to be able to draw in multiple layers, so for instance if I am to erase a rectangle or any other more complex object, I would only discard a layer and repaint that object as altered, not having to redraw the background or anything else. It is something like in Photoshop when you draw on the layer and you bring it to the front, then you can delete the whole layer at any moment later.
I only need a general guidance, not the actual code.
|
|
|
|
|
Keep the layers in a vector of transparent bitmaps. draw the bitmaps on top of each other using TransparentBlt().
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Let's say I have this piece of code...
CString strWndName = "My wnd";<br />
CString strClassName = "Wnd class";<br />
HWND hwnd = ::FindWindow(strClassName,strWndName);
Would it be possible to send a packet to hwnd using PostMessage?
If yes, which type of message should I send?
Thanks for help,
~Mike
|
|
|
|
|
WM_COPYDATA[^] might fit your needs.
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
Return, Crüxshadows
|
|
|
|
|
Ok thanks.
Let's say I want to send the 0x68 packet.
COPYDATASTRUCT cds;
cds.lpData = NULL;
cds.cbData = 1;
cds.dwData = 0x68;
Would this work?
And what should I send as WParam? 0?
Thanks a lot for your help
~Mike
|
|
|
|
|
I'm going to assume you are asking how you should use PostMessage to send a packet of information. "Which type of message" you should send depends on what you are trying to accomplish, which you haven't described. I'm also going to assume you are using MFC, and that you are trying to send a packet to a window created by your application.
If you are using PostMessage() , the message is placed on the window's message queue, and PostMessage() returns immediately. The window that receives the message may take some time before it processes the message. This means that the message will have to persist until the window gets around to looking at it. The easiest way to do this is to allocate your 'packet' on the heap, and deallocate it in the message handler. Here's an example:
#define MY_MESSAGE (WM_APP + 1)
class Packet {
public:
Packet();
~Packet();
int m1;
};
...
Packet *packet = new Packet;
packet->m1 = 123456;
CString strWndName = "My wnd";
CString strClassName = "Wnd class";
HWND hwnd = ::FindWindow(strClassName,strWndName);
::PostMessage(hwnd,MY_MESSAGE,0,(LPARAM)packet); This code sends your user-defined message MY_MESSAGE to the window with handle hwnd . Your handler for this message should be declared as follows:
afx_msg LRESULT OnMyMessage(WPARAM wParam,LPARAM lParam); and it's implementation will look like the following:
BEGIN_MESSAGE_MAP( MyWindowClass, <window base class> )
...
ON_MESSAGE(MY_MESSAGE,OnMyMessage)
END_MESSAGE_MAP()
...
LRESULT MyWindowClass::OnMyMessage(WPARAM wParam,LPARAM lParam)
{
Packet *packet = (Packet *)lParam;
delete packet;
return (LRESULT)0;
} I hope this helps. If you are trying to send messages between applications, there are other methods of interprocess communication (named pipes, sockets, and so on) that are simpler.
Software Zen: delete this;
|
|
|
|
|
Actually I am trying to send a packet to an online game.
That's why both your codes didn't work.
Thanks anyway, I hope you can help me
~Mike
|
|
|
|
|
packet to an online game? You need to send such packets to the query port of the game per UDP. What do you want to do exactly?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I want to send the 0x68 packet to my game.
I believe the client receives packets from the game server on port 6112, if this can help.
Thanks,
~Mike
|
|
|
|
|
Yes, read my posting above. Sending packets to game (servers) has nothing to do with PostMessage() or SendMessage() .
You need to use UDP (most games use UDP, don't know which ones use TCP).
Take a look at this article and its links section.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
WHOA .
PostMessage() is used to send Windows messages to windows, those funny things on the screen you interactive with.
The phrases 'online game', '0x68 packet', 'game server', and 'port 6112' tell me that you are trying to send a specific packet to an online game, and that the game communicates using TCP/IP sockets. That is a whole 'nother kettle of fish.
For introductory articles on socket programming under Windows, try here[^], here[^], and here[^].
You will also need to know the format of the packets used by the game to communicate.
Software Zen: delete this;
|
|
|
|
|
So basically I have to create a UDP socket on my game server's ip and write my packet onto it... Am I right?
Thanks,
~Mike
|
|
|
|
|
That's right. Like I mentioned in my earlier message, you'll need to know the format of the packet (how many bytes, what each byte means, and so on). Good luck.
Software Zen: delete this;
|
|
|
|
|
I have a Internet Shortcut in a control that I want to drag onto Explorer. I have looked at Michael Dunn's article and it almost works but it wants to copy the file to Explorer. Of course it is not a file, it is just data and I want to drag this data to Explorer and create a shortcut based on the data. In other words I have a list control of internet shortcuts and I want to drag one or more to Explorer. How can I do this? Thank you
|
|
|
|
|
I want to write a mini app (GUI) to start and stop my service remotely. I want to connect to the remote computer using this mini app(GUI) and start or stop or even querry the status of a service. I use c but i welcome c++ code.
thankx!
|
|
|
|