|
Did you try FindWindow?
Apparently, no one knows the answer since you've posted this at least 3 times already. Look in newsgroups.
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
why not fix the hang? I happen to like the ability to close programs that are misbehaving!
|
|
|
|
|
Hi. I am trying to create a configuration dialog for an application I am writing. It is (or at least will be) fairly complex, so I cannot fit all the configuration options in one dialog. So, I made the configuration dialog have a list box on the left side of the window, which lists different "sections" of the application. Depending on which section you have selected in the list box, the options on the right side of the dialog change.
One way I could have done this would have been to put all the controls for all the sections in the same dialog, and use ShowWindow() to show some and hide others depending on what is selected in the list box. I've done this before, and it's a big hassle. So, this time, I thought I would put the controls for each section into their own dialogs. I could then would only have to show and hide the dialogs. The dialogs would be child windows of the main configuration dialog.
To test this idea, I made the configuration dialog, which only has the list box, and "Ok" and "Cancel" buttons. The list box does nothing right now. In response to WM_INITDIALOG, it uses CreateDialog() to make the child dialog (and there's only 1 right now). I made a test child dialog which only consists of a few buttons, which do nothing. However, I am getting a weird issue when you click the buttons... after clicking them, they get thick, like a default button does, and stay that way.
To make it easier to understand what I'm saying, I made a little webpage with pictures demonstrating what happens when you click the buttons:
http://serialgaming.com:8080/nnirc/
I also tried deleting the manifest and using regular Windows95 buttons, and the same problem occurs.
I have spent many, many hours trying to get this working. I've looked throughout the web (including things on this website), but the only programs I could find which did something similar to mine were written in MFC (I'm not using MFC.)
Here's the code I'm using to create the dialogs:
To create the main, modal configuration dialog:
DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIGURE), hWnd, ConfigureDlgProc);
To create the child, modeless dialog (this is in WM_INITDIALOG of ConfigureDlgProc):
hDlg = CreateDialog((HINSTANCE)hInst, MAKEINTRESOURCE(IDD_TEST), hWnd, TestDlgProc);
ShowWindow(hDlg, SW_SHOW);
Here is the child modeless dialog's window procedure:
BOOL CALLBACK TestDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
return true;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
EndDialog(hWnd, IDOK);
break;
case IDCANCEL:
EndDialog(hWnd, IDCANCEL);
break;
}
break;
}
return false;
}
If you have any idea what's wrong, I'd really appreciate it. This has really baffled me more than any other problem I've ever had programming. Or, alternatively, if you have non-MFC source for a program that does something similar, I'd really appreciate it if you can show it to me.
Thank you for the help.
- Andy Oxfeld (andy@serialgaming.com)
|
|
|
|
|
I have been trying to create a reportview list control in MFC using the control toolbox and placing the list control on a dialog form, with the inbsertcolumn type function with the index parameter as zero. But I get two columns! One with my title specified, and one with no title. I only want one column to show up in my report view style list control. I hope its possible.....
|
|
|
|
|
Have you tried to just set the text for the first column? IIRC you always get one column, and if you add another column it would be obvious you see what you see.
Just an idea.
|
|
|
|
|
Heres what I'm using to set the column header:
m_list1.InsertColumn(0,"dir",LVCFMT_LEFT,70);
and to insert:
nItem = m_list1.InsertItem(0,str);
So how to set the column header and yet have only 1 column? If you put index as -1, it doesnt show up at all...
If you dont set the column header with insertcolumn, you cant populate with insertitem....nothing shows up in the box!
Thanks!
|
|
|
|
|
The second one is not a column, it's just the space not used by the first column. To correct, just resize the first column to fill all available space:
m_list1.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
Of course, if you resize your list, you'll then need to alter the size of the column also.
--------
Have you hugged your monitor today? --Shog9 --
|
|
|
|
|
Hello,
In my MDI project, I want to make the child CFormView dialog form unmoveable by the user. When I went to the dialog resources properties I saw that the titlebar property was already unchecked. However it still shows up with the blue caption bar and can be moved around inside the MDI frame. Is there some code I should use to accomplish this? I put in the precreate function of the child frame:
//cs.dwExStyle = WS_EX_DLGMODALFRAME ;
but it didnt seem to do anything different from when the line is commented out...the title bar that moves the window around is still there.....
Thanks very much for your help!
|
|
|
|
|
I got it! Thanks. I had to use cs.style = ~WS_CAPTION
Hurray!
Now to get rid of the Child scrollbars....
~WS_VSCROLL isnt doing it....
|
|
|
|
|
(I asked this in the COM forum, thought this one might get a responce sooner, sorry)
Hi, i appologise if this question has been asked be before but its got me stummped, i need to overwrite one of the function pointers in a COM interface, i dont have access to the COM source nor can i modify it, i simply need to overwrite the pointer, i keep getting access violations.??
Goes something like this.
IInterface * MyInterface= MakeInterface();
unsigned * vTbl = ((unsigned**)MyInterface)[0];
vTbl[THE_FUNCTION_INDEX] = NewFunction;
Hope that gives you the idea of what i want, kinda like hooking a COM interface, i have yet to find an easy/any soloution like simply overwriting the functions pointer.
|
|
|
|
|
Hello
I have a simple app, a CMainFrame with some CDialog derived based members, custom classes. One of the dialogs has a CComboBox. I want the main window to be informed when this drop down selection is changed. I have tried adding a handler in the main window, no luck. I have tried PostMessage, SendMessage, and checking for the message in the main window using 'DefWindowProc' and using ON_MESSAGE maps. Nothing. If I add a handler to the dialog class it does detect the selection change, but this is no use to me, as I want the main window to be able to react also.
I am sure that what I am doing is so simple, so useful and so obvious that there is an easy way that I don't know about. Can anyone help?
Cheers,
solosnake
|
|
|
|
|
If you're launching the dialogs as modals in response of some menu action of mainframe you may block the main thread's message queue.
Try launching some worker thread and communicate to the worker, or launch the dialogs as modelesses.
rechi
|
|
|
|
|
No, they are not modals but continously displayed windows.
Cheers,
solosnake
|
|
|
|
|
the function "DoDataExchange" can be used to update variables in your main CMainFrame. This is called automatically on Exit or you can do it yourself.
I am not sure if this would work but you could use a handler to the dialogue class to detect a change if it is detected then call DoDataExchange to update your CMainFrame
Eric
|
|
|
|
|
OK , but the problem is that the combo box represent the user choosing an item in a internally maintained array of items. The main frame holds this array. When the user changes the combo box I want the main window to be notified so that it can change the required values that the dialog displays. The dialog is never closed, so data must be updated as a response. Thanks for the ideas, but I need some more?
Cheers,
solosnake
|
|
|
|
|
You may try to have in the dialog class a member that is a reference or a pointer to the array in the CMainFrame class. Thus you would be acessing those members directly.
Best regards,
Alexandru Savescu
|
|
|
|
|
Hello
Thanks to everyone who replied. I have solved the problem, which was partially of my own making anyway. I am now registering a new message, and sending it from the deep child window. The difference, which is not well documented in the help, is that SendMessage only sends to its own message queue. By using AfxGetMainWnd()->SendMessage I can get a message back out to the upper level windows. I have added a custon ON_MESSAGE handler, and everything is working fine. Thanks for all suggestions, and I hope my problem and solution can help someone else perhaps.
Cheers!
solosnake
|
|
|
|
|
Hi! I'm trying to create a static box into a FormView derived class, i tryed like this:
void CUnits_Sold::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
//This lines had the propose of initialize the pointer, i could not find another way to do it!
CStatic estatico;
CStatic* estatico2;
estatico2=&estatico;
estatico2->Create("Olá", WS_CHILD|WS_VISIBLE|SS_NOPREFIX|SS_LEFTNOWORDWRAP, CRect(30, 30, 100, 100), this);
estatico2->ShowWindow(SW_SHOW);
}
Anyone have a clue why this isn't working?
Thank you
|
|
|
|
|
|
Hi,
I'm trying to port some unix code over to visual c++. Can anyone tell me if there is an equivalent to the unix types sema_t and key_t.
Cheers
Steevie
|
|
|
|
|
You just might want to be a little more specific. Otherwise I could answer like this;
Sure, just typedef int sema_t; and so on. Please explain what these types are used for, and how they are used, and I'm sure you'll get an intelligent answer.
Note however if you're targetting Visual C++ you might get answers referring to the worst "designed" class library of all times (MFC). Perhaps you should initially limit yourself to Win32? Just an idea.
|
|
|
|
|
sema_t is a UNIX POSIX semaphore structure defined as follows
typedef struct {
pthread_mutex_t lock;
pthread_cond_t cond;
int count;
} sema_t;
Then you can define for WIN32
typedef HANDLE pthread_mutex_t;
typedef struct pthread_cond_t {
int waiters_;
CRITICAL_SECTION waiters_lock_;
HANDLE sema_;
HANDLE waiters_done_;
size_t was_broadcast_;
} pthread_cond_t;
|
|
|
|
|
key_t is defined as follows
typedef int key_t
|
|
|
|
|
Hi,
I am trying to make my client area view based on CFOrmView fit exactly into the client area of the parent and resize along with it. ANy ideas would be appreciated. Thanks
|
|
|
|
|
Why not simply rewrite it to fit the client area???
|
|
|
|
|