|
Hi Ernest,
thanks for your reply. Unfortunately the window does NOT close after the user releases it, in fact the window is kept open and the thread stays alive for an undefined time!
Is there a way to stop the dragging mode? I suspect that the other messages are processed, otherwise the window would close after the user releases it...
Regards,
Ruediger
|
|
|
|
|
Okay, why not just destroy the window yourWindow.DestroyWindow(); ?
Sending a message with WM_DESTROY has the same effect. I suspect when you say
*dragging*, you mean the user is *moving* the window. In anyway, you should not
worry! if you need to destroy that window, just destroy it! (this is a progress
dialog, right?)
That should fix your problem.
Good luck!
"Dirty hands lead to important discovery..." - Thomas Edison
|
|
|
|
|
I tried that one too but it didn't help. The problem is that the UI thread was blocked and did not receive any messages but I found that solution now in case anybody encounters a similar problem:
in the destroy function of the calling thread I did the follwing:
DWORD dwProcessId = GetWindowThreadProcessId(m_hParentWnd,0L);
::AttachThreadInput(dwProcessId,m_pThread->m_nThreadID,TRUE);
::ReleaseCapture();
m_pThread->PostThreadMessage(WM_QUIT,0,0);
::AttachThreadInput(dwProcessId,m_pThread->m_nThreadID,FALSE);
And so it worked
Anyway, thanks for the help!!!
Regards,
Ruediger
|
|
|
|
|
Try using a 'SendMessage' instead of 'PostMessage', if you are unsure of the difference, post asynchronious and send message is synchronious....
|
|
|
|
|
I want to post a message to a window by its handle.
how can i retrieve the handle of a window?(I need this handle to post the message using the function
BOOL PostMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam );
thanks,
Aviv.
avivhal
|
|
|
|
|
GetWindow()<br />
FindWindow()<br />
FindWindowEx()<br />
GetDlgItem()
Jeremy L. Falcon
"The One Who Said, 'The One Who Said...'"
<nobr>
Homepage : Sonork = 100.16311 01000010011011110110001000100000011101110110000101110011 00100000011010000110010101110010011001010010111000000000
|
|
|
|
|
Hello,
I need to read the following two lines from a .txt file.
Name John Doe
Number +12345
Then I must extract "John Doe" and "+12345" and send them to an edit box.
I tried using strtok() but it didn't work the way I want it to. Is there a way of starting at a particular point in the string? eg in "Name John Doe" at position 6.
Thanks,
Aoife
/********************************************/
FILE *stream;
stream = fopen( "number", "r" );
char bufLine1[30], bufLine2[30];
fgets(bufLine1, 30, stream);
fgets(bufLine2, 30, stream);
char *pNext1 = ?????(bufLine1, ??);
char *pNext2 = ?????(bufLine2, ??);
strcpy(bufLine1, pNext1);
strcpy(bufLine2, pNext2);
SendDlgItemMessage(IDC_BOX1, EM_REPLACESEL, FALSE, (LPARAM)bufLine1);
SendDlgItemMessage(IDC_BOX2, EM_REPLACESEL, FALSE, (LPARAM)bufLine2);
fclose( stream );
|
|
|
|
|
Have a look at CString's Mid and Right functions.
Michael
|
|
|
|
|
You can use std::string and std::ifstream like this;
ifstream in ("number");
string dummy, Name, Number;
in >> dummy >> Name;
int >> dummy >> Number;
Best regards,
Alexandru Savescu
|
|
|
|
|
If you know that the text starts in column 6, then
char *pNext1 = &bufLine1 [6];
will work just fine.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
This worked perfectly, Thanks!
|
|
|
|
|
hi!,
i want to insert text into a ListBox on the Main Dialog of my Application and update my dialog screen while program is in a function which resides in another Cpp file of my project. i call Main Dialog function, which updates text, in that function (in Cpp) and program suddenly terminates when it tries to add string into ListBox.
How will i reach the memory resource of Main Dialog Controls when i'm in another cpp?
While i was debugging i saw that there is no handle assigned to ListBox when Main Dialog function was called inside the other function in that Cpp.
Thanks for ur help
Atilla Selem
willing to learn and teach
|
|
|
|
|
You'll need to post the portion of your code that is going wrong.
I'm guessing that the Window for the Listbox hasn't been created at the point you are trying to update it.
Are you calling the function on the same instance of the dialog class?
Michael
|
|
|
|
|
i have just found the mistake that i did (shown below). i had forgetten to uncomment line (2) so i couldn't have reached any control of my Dialog that i want to update...
Thanks for ur interest..
Atilla Selem
// SockDlg.cpp : My implementation file
(1) CSockDlg* pSockDlg;
(2) pSockDlg=(CSockDlg*)(CWnd::FromHandle(m_hWnd));
// MulticastSocket.cpp : Cpp that i call my dialog funtion to update text in
my ListBox;
extern CSockDlg* pSockDlg;
{
..
..pSockDlg->OnReceive();
}
-----> m_ctlRecvd.AddString(strRecvd); // which resides in OnReceive() in SockDlg
and it has worked!...
willing to learn and teach
|
|
|
|
|
What is the difference between the handle of a window(type HWND) and the instance (type HINSTANCE)?
thanks
avivhal
|
|
|
|
|
One is the handle to a window and the other is the handle to a EXE or DLL loaded in memory.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
HINSTANCE and HMODULE is the real address inside a processpace. HWND is just an internal reference number. It is not generally safe to cast handle types to anything else.
/moliate
|
|
|
|
|
Dear all,
I seen many classes about bmp image.
But there seems a few cases in dealing with
setpixel for 8-bit bmp file.
Based on my code as follows, would you please
tell me how to setpixelcolor for 8-bit bmp image?
class CDraw8
{
public:
CDib *m_dib; // the DIBSECTION
COLORREF m_pal[256];
BYTE *m_adr; //start-address of image-data
int *m_yadr; // array with line-start-addresses
CDraw8();
BOOL Init(CDib* dib);
// read RGB color, using pixel-value as index to palette
COLORREF GetPixelColor(int x, int y)
{return m_pal[m_adr[m_yadr[y]+x]];}
void SetPixelColor(int x, int y, COLORREF col);
//???? How to do this //
COLORREF GetPixelIndex(int x, int y)
{return m_adr[m_yadr[y]+x];}
SetPixelIndex(int x, int y, BYTE index)
{ m_adr[m_yadr[y] + x] = index;}
}
Thanks in advance!
xyz
|
|
|
|
|
I've been doing alot of research into Device Independant Bitmaps lately, and everything that I've read states the the pixel data stored in an 8bit bitmap image isnt actually color data at all. The data is merely an index into that bitmap's color palette. So, to change a particular pixel's color, you have 2 choices:
1) Change that pixel's index into the color palette.
OR
2) Change the RGB values in the color palette for that pixel's index.
I would suggest the first option because it only affects the pixel you would like to change. Changing an entry in the color palette could cause other pixels to change color also.
I am by no means an expert on this topic, I've just been doing alot of reading about this stuff lately and I thought I might be able to help. Hope I did.
-Mike Zinni
Software Engineer
email: mzinni@rimail.com
AIM: zin9999
|
|
|
|
|
It seems the ClassWizard has gone from Visual Studio.NET, this was very handy when working with dialogs for associating member variables with controls and adding handlers for messages e.g. WM_INITDIALOG, have I missed an alternative in Visual Studio.NET?
|
|
|
|
|
There is a properties pane for everything in VS.NET.
First Select the class you wish to add a handler or member variable to.
To add a handler, use the events (or is it messages...) property page; just find the message you're looking for, drop down the list next to it, and select add new.
To add a member variable, just right-click on the class name in the classview and select add->member variable. One of the options on the resulting dialog is to associate the variable with a control.
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
|
Let's say we have a toolbar with a button and the button doesn't have a menu
item corresponding to it.
The button is a checkable one and i want to set its state (checked/unchecked)
without using the mouse or keyboard.
Do you have any idea?
rechi
|
|
|
|
|
Call:
m_wndToolBar.SendMessage(TB_CHECKBUTTON, IDR_TOOLBAR_BUTTONX,
(LPARAM)MAKELONG(bCheck,0));
rechi
|
|
|
|
|
Just write an OnUpdateCommandUI handler for it as you would a regular menu option.
pCmdUI->SetCheck(state) ;
If you change the state flag somewhere in code, the button will change state on the next idle time when the MFC code queries the state of all the UI options.
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|