|
Tim,
I’ve been writing server apps w/o a GUI so bear with me on my next question. Why would the GUI hang if a message queue has been created on an independent worker thread? I’m beginning to believe that a queue has not been created because the call to PeekMessage returns FALSE.
-Kevin
|
|
|
|
|
I figured out why the GUI was hanging. A mistake not related to the Message Queue. But I still can't get the Message Q to work. Is there any reason why the scheme in my first post would not work?
Is the thread ID that I get from the CWinThread valid to use in:
PostThreadMessage(pThread->m_nThreadID, 1,1,1);
Thanks,
Kevin
|
|
|
|
|
Without more example code, I have no idea.
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?
|
|
|
|
|
I gave up on trying to create a message queue in an MFC worker thread by calling PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
There is a good article by Joseph M. Newcomer titled "Using User-Interface Threads" which describes what I wanted to do using UI Threads.
I still would like to know why i can't create the message queue, though!
-Kevin
|
|
|
|
|
I am having much trouble getting my shellnew object to appear on Explorer's right click New> menu...
I have tried putting it in the Winnt\ShellNew, I have tried creating the ShellNew key (and even tried values) under my filename under HKEY_CLASSES_ROOT...
There just seems to be nothing I can do to get it to work.
I would appreciate ANY pointers you have, because this is crucial to my application's release.
-- Chas
gte761u@prism.gatech.edu
|
|
|
|
|
Assuming your extension is .foo, under HKCR\.foo\ShellNew you need to create a value that tells the shell how to create new .foo files:
Command Executes an application. This is a REG_SZ value specifying the path of the application to be executed. For example, you could set it to launch a wizard.
Data Creates a file containing specified data. Data is a REG_BINARY value with the file's data. Data is ignored if either NullFile or FileName is specified.
FileName Creates a file that is a copy of a specified file. FileName is a REG_SZ value, set to the fully qualified path of the file to be copied.
NullFile Creates an empty file. NullFile is not assigned a value. If NullFile is specified, Data and FileName are ignored.
--Mike--
Rollin' in my 5.0
With the rag-top down so my hair can blow.
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
I tried to use NullFile with no success... I tried Data too.
Any other ideas? (or should I really do Command)
Is there some kind of COM object in which you have to modify the context menu with InsertMenu or something?
-- Chas
gte761u@prism.gatech.edu
|
|
|
|
|
Anyone know how to increase the height of a tab header (the bit with the label and image on it).
I have an override for DrawItem, but basically it just changes the font and colour. The trouble when the font is bigger than the default it gets clipped. It would be nice to work to work out the width and height (using GetTextExten32 I guess), but it's the height I want to increase specifically.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
I'm not sure about tab control, but with owner-draw listbox you handle WM_MEASUREITEM if you want to change item height. At least give it a try.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi all,
In one of my program parts, i must make almost 25 fields in atleast 4 table.
I used CDaoTableDef for making tables and fields, i have strange problem in that.
When i wanna make a boolean field i got this error: "Data Type Conversion Error.".
But i have not any problem for creating text or double and ... fields !
Here is my source code:
tdP.CreateField( "PVISIBLE", dbBoolean, 1 );
What is wrong in this code ?
Please help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
dose anybody know the code for clearing editboxs, radio buttons etc? Like a refresh button on my dilaog box.
thanks
|
|
|
|
|
For edit box check CEdit::SetSel
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
When people place refresh buttons, they manually reset every control on the dialog.
For radio buttons call:
CheckRadioButton
Checkboxes uses:
CheckDlgButton
To clear the text in an edit box call:
SetWindowText
|
|
|
|
|
If this is an MFC program you can do a short-cut trick. Call UpdateData(false) and assuming you have not misused UpdateData at all [which means your DDX member variables get UpdateData'd only on OK] this will reset every control back to how it was on dialog-load. Understand me?
Nish
Bow wow wow,
Yippee yo yippee yay,
My miniputt high,
Is now 30 yay.
|
|
|
|
|
beginner
how can i read text entered in a edit box? plus 1 to it and the display the result in a list box?
|
|
|
|
|
GetWindowText, to get the text. atoi to convert it to a number. CString::Format to turn it back into a string, then insert it into the listbox.
CString strNumber;
MyEdit.GetWindowText(strNumber);
int nNumber = atoi(strNumber);
strNumber.Format("%d", ++nNumber);
I forget how to insert strNumber into a listbox
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
its not the adding 1 to the text that is that important. it's just reading the box copying and displaying it into the list box
is there any way doing this without chaging the text in to number form
a ver slow beginner
|
|
|
|
|
In that case, you just need GetWindowText to grab the text that is there, and twhatever the Insert command is for a list box to pop it into the list box. Converting it to an int is only needed because you said to increment it.
GetwindowText/SetwindowText allows you to grab and put the text in an edit box.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Christian Graus wrote:
the Insert command
m_MyListBox.AddString("bla bla");
Was this what you were looking for?
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
I guess - I didn't actually look
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Hi,
I would like to search for file *.abc & *.xyz in a folder.
For this what should be the first parameter( LPCTSTR lpFileName) in FindFirstFile() ?
Thanks
Neha
|
|
|
|
|
Do you mean that you want to find "*.abc" OR "*.xyz" in a folder? If so, I think you need two FindFirstFile() calls.
HANDLE h1 = FindFirstFile( "*.abc", &filedata1 );
HANDLE h1 = FindFirstFile( "*.xyz", &filedata2 );
You have a match when,
if (( h1 != INVALID_HANDLE_VALUE ) || ( h2 != INVALID_HANDLE_VALUE ))
{
.....Process h1
.....Process h2
}
Joe M
|
|
|
|
|
Hi CPians,
In one of my projects, I need a property sheet but there must be a header control on top of the propety sheet. I solved the problem using the source code of CPropertSheet from MFC. Here is the main part of the code:
CStepCreatorSheet is derived from CPropertySheet
BOOL CStepCreatorSheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
CRect rectWnd;
GetWindowRect (rectWnd);
ScreenToClient(rectWnd);
SetWindowPos (NULL, 0, 0, rectWnd.Width(), rectWnd.Height() + m_nHeaderHeight,
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
m_HeaderCtrl.CreateEx (NULL, NULL, NULL, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
-1, -1, rectWnd.Width (), m_nHeaderHeight - 5, m_hWnd, 0, 0);
HWND hWnd = (HWND)GetTabControl()->m_hWnd;
ASSERT(hWnd != NULL);
CRect rectOld;
::GetWindowRect (hWnd, &rectOld);
ScreenToClient (&rectOld);
::SetWindowPos (hWnd, NULL, rectOld.left, rectOld.top + m_nHeaderHeight, rectOld.Width (), rectOld.Height (),
SWP_NOZORDER | SWP_NOACTIVATE);
hWnd = (HWND)m_pMainPage1->m_hWnd;
ASSERT(hWnd != NULL);
::GetWindowRect (hWnd, &rectOld);
ScreenToClient (&rectOld);
::SetWindowPos (hWnd, NULL, rectOld.left, rectOld.top + m_nHeaderHeight, rectOld.Width (), rectOld.Height (),
SWP_NOZORDER | SWP_NOACTIVATE);
for (int i = 0; i < sizeof(_PropSheetButtons) / sizeof (int); i++)
{
hWnd = ::GetDlgItem(m_hWnd, _PropSheetButtons[i]);
if (hWnd != NULL)
{
::GetWindowRect (hWnd, &rectOld);
ScreenToClient (&rectOld);
::SetWindowPos (hWnd, NULL, rectOld.left, rectOld.top + m_nHeaderHeight, rectOld.Width (), rectOld.Height (),
SWP_NOZORDER | SWP_NOACTIVATE);
}
}
CenterWindow ();
return bResult;
}
BOOL CStepCreatorSheet::OnCommand(WPARAM wParam, LPARAM lParam)
{
if (CWnd::OnCommand(wParam, lParam))
return TRUE;
UINT nID = LOWORD(wParam);
HWND hWndCtrl = (HWND)lParam;
int nCode = HIWORD(wParam);
if (hWndCtrl != NULL && nCode == BN_CLICKED)
{
if (::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0) &
(DLGC_BUTTON|DLGC_DEFPUSHBUTTON))
{
LONG lStyle = ::GetWindowLong(hWndCtrl, GWL_STYLE) & 0x0F;
if (lStyle == BS_PUSHBUTTON || lStyle == BS_DEFPUSHBUTTON ||
lStyle == BS_USERBUTTON || lStyle == BS_OWNERDRAW)
{
if (nID == IDOK)
{
if (m_pMainPage1->OnUpdate ())
m_nModalResult = nID;
else
return TRUE;
}
}
}
}
return FALSE;
}
This code works like a charm
The problem is that I am not sure if this is the correct way to add a control at the top of the sheet or not. If there are no other ways, I can write a good article for this. I am looking forward to hearing your suggestions.
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
|
|
|
|
|
If it works like a charm I wouldn't wotry more about it.
Now seriously, your code seems fine to me. In fact you might consider doing a bunch with it and posting an article here at CP.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi Joaquín,
Thanks for your reply.
I asked this question, because I am not a GUI guru . In fact, I have never needed such a thing and because of this I am just curious if I am in the right path or not. If I get confirmations from the professionals, I will surely post an article about this issue . There are no articles about this, as far as i know.
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
|
|
|
|
|