|
Mauricio
MAKEINTRESOURCE returns a LPTSTR. But it should only be passed to resource functions. The best thing would be to re-prototype your function as :-
void blah(LPTSTR lpszFile,BOOL IsResource)
{
if(!IsResource)
{
DWORD dwSize = strlen(lpszFile);
}
}
My most recent CP article :-
A newbie's elementary guide to spawning processes
www.busterboy.org
|
|
|
|
|
Nish [BusterBoy] wrote:
MAKEINTRESOURCE returns a LPTSTR. But it should only be passed to resource functions. The best thing would be to re-prototype your function as :-
That´s the solution I found... but that macro could be really usefull.
Tks Nish
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
|
|
|
|
|
Hi,
Is there a "right" way for me to communicate with a CWinThread object???
My new, UI threaded smtp daemon now works like the following:
1. Primary thread has listening socket. In OnAccept(), I use a plain CAsyncSocket object to accept the new connection. I then detach this object from the socket in order to get the SOCKET of the connected socket.
2. Still in OnAccept, a AfxBeginThread a new instance of my CWinThread derived class. I set a member of this object to the SOCKET identifier i received on the Detach().
3. In my CWinThread classes initinstance(), i attach a member socket to the SOCKET i just shoved into the class.
Suprisingly, this seems to work. CWinThread's InitInstance doesn't seem to get called until after my OnAccept function has returned, hence the SOCKET handle in the CWinThread class is valid. But, it strikes me that this is pure fluke, the CWinThread could init itself at any time.
I thought about using a MUTEX to block the new threads execution in InitInstance, and release the mutex from the OnAccept function when i had finished detaching. But this seems crap too, since I'd have to use a named Mutex, because I cannot pass a handle to the CWinthread for the same reasons I can't get it a SOCKET.
Is there a better way to set up this object? An ideal way I think would be to have an overloaded constructor in the CWinThread derived class. But I *think* I can't do this becuase the class is dynamically created with RUNTIME_CLASS. Or is there a way to pass arguments to an overloaded constructor with dynamic creation????
Thanks
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
A safe way to perform object transfer is to create the thread with flag CREATE_SUSPENDED , do the transfer and then call CWinThread::ResumeThread .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Perfect!
That is ideal, thanks again Joaquin
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Dear Fellow Programmers,
I have managed to implement the Drag/Drop mechanism. I have also been able to implement a toolbar from which bitmaps can be dragged.
However when I drag the bitmap image over the container window it is unable to drop (it just stays attached to the cursor) when the button is released (On LButtonUp) the bitmap doesn't stay on the screen - it disappears.
I think i need to implement some sort of method in either the OnDraw or OnLButtonUp member functions - and this where the problem really starts!!!.
Can anyone tell me whats going wrong?
|
|
|
|
|
I'm trying to simulate key presses with SendInput. I've discovered that if the string I'm simulating contains 2 or more consecutive identical characters, only one of them appears.
Any ideas?
Thanks!
|
|
|
|
|
This is a stupid question, I know I can use EnumChildWindows () but isn't there a simplier way to do it ? Quick tip please.
Tx.
|
|
|
|
|
Why not just use GetWindow(GW_CHILD) on the mdiframe window, then call GetWindow(GW_HWNDNEXT) for all of its siblings which should be MDI children as well. This should be a small loop.
|
|
|
|
|
Hi all,
I used a ActiveX in my program, one of method in ActiveX appear a MessageBox, i wanna send a message for closing that ...
I wrote it after using of the method:
m_Control.Method() // MessageBox() appeared !
SendMessage( WM_KEYDOWN, 13, 0 );
But it doesn't work, how can do that ?
HELP ME
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
You will not be able to do it from the same thread that you called message box from unless you hook the creation of the message box and subclass the message box, because MessageBox is a modal function. The processing from the message box function will not continue until the Message box window is closed..
|
|
|
|
|
|
Alternatively, you could do a PostMessage (WM_COMMAND, nCode); where nCode is an applicable value such as IDOK, IDCANCEL, etc. In either case, this would need to be done from a separate thread (as pointed out earlier).
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Always is message WM_PAINT (for parent window) sent before message WM_PAINT (for child windows). But I have in OnPaint function(parent window) some drawing code which must redraw childwindows!
for example : You clicked on control (with flag WS_DISABLE => ). App in WM_LBUTTONDOWN(parent window <= control has WS_DISABLE) drow red rectangle on place where you clicked. Next you resizeing/moving windows. Windows call WM_PAINT (for parent window) next for control => If OnPaint (parent window) drow below control you dont see anything
LWB
|
|
|
|
|
There are two things that you could do.
1. Tell the child control not to paint itself at all at the time you are interested in, in your WM_PAINT handler by calling ::ValidateRect(hWndChild, NULL). This will validate the invalid region of your child control, and Windows will never generate a WM_PAINT message for the child.
2. Right before the code that you want to paint the red rectangle or what ever else, force an update of the child window with a call to UpdateWindow(hWndChild), this will force the control to update itself, then you can draw the stuff that you want, and the child will not redraw after that.
|
|
|
|
|
How can i convert my HTML file to rtf file?
Thanks,
Kumar Saurabh
|
|
|
|
|
Just copy and paste the text from IE into Wordpad or Word and save it as an rtf.
Simon
There's one for you, nineteen for me
Sonork ID 100.10024
|
|
|
|
|
Hi Simon,
I don't 'vce to do this manually, but programatically. also i want my html file (with images) to be converted into rtf, not only text. when a HTML file opened in word is saved as rtf, then the conversion is done (this is done by automation) but gif's are not rendered, moreover, if you open the file using wordpad then you won't be able to see any image.
Thnaks,
Kumar Saurabh
Software Engneer
Syndew Pvt Ltd
New Delhi
India
|
|
|
|
|
Its kinda of tedious but this one works.
You need to parse the html content urself and construct the rtf, the rtf specs are available here
Actually I have done the other way around by parsing rtf and then converting into html.
For parsing html i think you need to convert it to xhtml or something like that and then construct rtf accordingly.
If you find a easier way do let me know.
Hope this helps.
Cheers
Kannan
|
|
|
|
|
Search Google for "html2rtf". There are a lot of apps, mostly with source. Here is one that is written in perl.
/moliate
|
|
|
|
|
|
is right - what the hell are you talking about ?
Guessing wildly as to what you may be asking, C# is a new lagnuage which owes more to Java than C++, it does not have MFC.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
I took it to mean "what will happen to MFC after .NET?".
MFC will continue to be around for a good while, so don't worry.
Simon
There's one for you, nineteen for me
Sonork ID 100.10024
|
|
|
|
|
MFC 7.0
It did not go away since C# and C++.NET came out. Micro$oft just made some bug fixes and enhancements and bumped up the version number.
|
|
|
|
|
Hi !
My App has an Explorer-like interface, with a leftview and a rightview. The leftview is a Tree control and the right view is a List control. I overrides the OnContextMenu function in each view to display a popup menu.
I have something weird : when I right click in the right pane, my popup menu appears normally. When I right click in the left pane, the menu doesn't appear. But, if I right click in the left pane, move the mouse with the right button still pressed and after that, release the right button, the pop up menu appears !!!! In my code, I handle the OnContextMenu the same way in the left view as in the right view !
Does anyone know what could be the problem ?
Thank you !
Jerome
|
|
|
|