|
sspcmp:
Unless your reply is relevant to my reply, you should reply to the question instead of my reply. I received notification of your reply by email but I already know how to use the debugger.
|
|
|
|
|
Hi, I am stuck...
We use a custom control (yes, THE Grid Control in a big project .
With NT4 everything is running fine, but now someone dared to run it with Win98 and W2k.
The Result: every dialog with the grid in it refused to open!!!
The samples provided with the grid run fine on the same machine, so it is nothing with the grid.
When I setl the custom control in the resource editor to the classname EDIT, the dialog starts (but it looks terrible, of course .
So: what can be wrong in this project?
ANY hints?
Martin
|
|
|
|
|
Did you try to recompile the code under w98 ? I have experienced some similar problems - I can't run the programm compiled in NT under 98 , but the programm compiled under 98 it works fine on both NT & 98.I think some links aren't good ....
|
|
|
|
|
Yes, I tried it, but with no success.
In the meantime I got another hint:
The dialogs don't load when I put the ressources into an external DLL (as it is the case in this project)!
Is there a way to tell the application, that it has to run with such an external DLL AND custom controls?
Did I miss something important to do? Every other dialog works just fine, only the dialogs with custom controls in it refuse to load...
Martin
|
|
|
|
|
Hi, I've got it!!!
When using an external DLL, you have to register the window class for THAT DLL!
So you have to set the hInst of the WNDCLASS-structure via AfxGetResourceHandle() instead of AfxGetInstanceHandle() as it is done most of the time...
Happy greetings, Martin
|
|
|
|
|
Hi, I am stuck...
We use a custom control (yes, THE Grid Control in a big project .
With NT4 everything is running fine, but now someone dared to run it with Win98 and W2k.
The Result: every dialog with the grid in it refused to open!!!
The samples provided with the grid run fine on the same machine, so it is nothing with the grid.
When I setl the custom control in the resource editor to the classname EDIT, the dialog starts (but it looks terrible, of course .
So: what can be wrong in this project?
ANY hints?
Martin
|
|
|
|
|
here is a Shot in the Dark. hope it may be help.
Don't use the Default name for the dialogs controls
i.e
When the Control's ID is IDC_STATIC I used to have weird problems of th dialog not showing in . or the control it self not being used win98 fine when using nt.
(I guess because the value for, IDC_STATIC is = -1 in win95 , which can't be used
Try changing the ID of the control to somthing Diffrent. like IDC_MYCONTROL. (geee, that was imaginitive of me )
Cheers
Alfadhly
|
|
|
|
|
Thanks, Alfadhly,
but that's not the point, all the controls have other IDs.
In the meantime I got another hint:
The dialogs don't load when I put the ressources into an EXTERNAL DLL (as it is the case in this project)!
You can do this with a minimal test app and you will get the same problems!
Is there a way to tell the application, that it has to run with such an external DLL AND custom controls?
Did I miss something important to do? Every other dialog works just fine, only the dialogs with custom controls in it refuse to load...
Martin
|
|
|
|
|
Hi, I am stuck...
We use a custom control (yes, THE Grid Control in a big project .
With NT4 everything is running fine, but now someone dared to run it with Win98 and W2k.
The Result: every dialog with the grid in it refused to open!!!
The samples provided with the grid run fine on the same machine, so it is nothing with the grid.
When I setl the custom control in the resource editor to the classname EDIT, the dialog starts (but it looks terrible, of course .
So: what can be wrong in this project?
ANY hints?
Martin
|
|
|
|
|
hi,
I use CreateProcess to execute an application from within my code.
i want to simulate menu item clicks in the application from within my code.
I presume this can be done using SendMessage where i pass
the appropriate menu id as the loword of wparam
But how do i get the window handle from?
i just have the process id that was returned by CreateProcess
Thanks in advance,
Gita
|
|
|
|
|
You can enumerate all the top level windows, then call GetWindowThreadProcessId on each one until you find the same process id. However you can't say if it's the only top level window created by that process.
Try code like this:
<br />
#define TIMEOUT 20*1000<br />
<br />
struct ProcessWindow<br />
{<br />
DWORD processID;<br />
DWORD threadID;<br />
HWND hwnd;<br />
};<br />
<br />
static BOOL CALLBACK EnumWindowsProc(<br />
HWND hwnd,
ProcessWindow *lParam
)<br />
{<br />
DWORD processID = NULL;<br />
DWORD threadID = GetWindowThreadProcessId(hwnd, &processID);<br />
<br />
if (processID == lParam->processID && threadID == lParam->threadID)<br />
{<br />
lParam->hwnd = hwnd;<br />
return FALSE;
}<br />
<br />
return TRUE;<br />
}<br />
<br />
HWND StartApp(LPCTSTR path)<br />
{<br />
STARTUPINFO si;<br />
ZeroMemory(&si, sizeof(STARTUPINFO));<br />
<br />
si.cb = sizeof(STARTUPINFO);<br />
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;<br />
si.wShowWindow = SW_HIDE;<br />
<br />
PROCESS_INFORMATION pi;<br />
<br />
TCHAR buf[MAX_PATH];<br />
lstrcpyn(buf, path, MAX_PATH);<br />
<br />
if (!CreateProcess(NULL, buf, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE |<br />
NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi))<br />
return NULL;<br />
<br />
if(WaitForInputIdle(pi.hProcess, TIMEOUT) != 0)<br />
return NULL;<br />
<br />
<br />
ProcessWindow pw;<br />
pw.hwnd = NULL;<br />
pw.processID = pi.dwProcessId;<br />
pw.threadID = pi.dwThreadId;<br />
<br />
if (EnumWindows((WNDENUMPROC)EnumWindowsProc, (LPARAM)(LPVOID)&pw))<br />
return NULL;<br />
<br />
return pw.hwnd;<br />
}<br />
I've used it with success. I hope it will work also for you.
Cheers,
Paolo.
|
|
|
|
|
I have an SDI MFC application. I've created the UI similar to the MSDN with a tab control in the left splitter and then in the right I have ActiveX controls and such that the user interacts with. Now, when the user for instance goes to the 'Contents' tab and opens one of the items I want to create a dynamic splitter to show that information. I don't however want to destroy the control in the other splitter window. So, basically when they select an item in the 'Contents' tab it sets the controls window to a size of zero and sets the other page to full size. The problem I have is closing the contents item and redisplaying the control window. I wanted to do something like an MDI where the user can click on the close button and it will set the contents to a size of zero and set the control to full size. Can anyone shed some light on if it's possible to place an MDI type close button in an SDI application?
Thanks for any help,
Craig
|
|
|
|
|
Hello, I'm a novice VC++ developer that would like to know how to change the background color of an edit control that has been marked as read-only.
Thank you in advance.
|
|
|
|
|
I think you want to override WM_CTLCOLOR for read-only edit controls the same as for other edit controls. There are some Microsoft Knowledge Base articles about it.
I know that the CodeGuru web site has some articles about changing colors and I assume that the CodeProject does too. Also see the MFC technical article "TN062: Message Reflection for Windows Controls" for an example.
See the bottom of http://home.socal.rr.com/samhobbs/Technical/ for my little description of the Microsoft Knowledge Base. You probably have a copy of the Knowledge Base that was provided with Visual C++ but I do not know if it is. Perhaps it is only supplied with the MSDN. In step 1, select "Visual C++". In step 2, use the default (keyword search using all words). In step 3 ("My Queston is"), enter "WM_CTLCOLOR".
|
|
|
|
|
Sam Hobbs is correct.
A sample would be :
1) add the WTL_CTLCOLOR message to your dialog.
This will create a function :
HBRUSH YOUR_DIALOG::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
2) say you want to change the background color
of IDC_EDIT9 to yellow [ RGB(255,255,0) ]
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
COLORREF m_clrBack;
CBrush m_brush;
if (pWnd->GetDlgCtrlID() == IDC_EDIT9)
{
m_clrBack = RGB(255,255,0);
pDC->SetBkColor(m_clrBack);
m_brush.CreateSolidBrush(m_clrBack);
return (HBRUSH)m_brush.GetSafeHandle();
}
else
return hbr;
|
|
|
|
|
The control that must be painted has more than one line and in this way only gets painted the first line.
I wouldn't like to abuse, but I'm just a novice and I need help...
Thank you for your comprehension and help.
|
|
|
|
|
this is the info. I can give to you:
the edit control is created at runtime:
if (!m_cedText.Create(WS_CHILD | WS_HSCROLL | WS_VSCROLL | ES_MULTILINE | ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_READONLY,CRect(0,0,0,0),this,IDC_EDTEXT))
{
TRACE0("Error en la creació de l'EditBox per a la finestra dockable DlgBarDockSessio.\n");
return -1;
}
m_cedText.ModifyStyleEx(0, WS_EX_CLIENTEDGE);
m_cedText.SetFont(TCCApp.GetDefaultTextFont());
And as in the sample I have processed the WM_CTLCOLOR message:
HBRUSH hbr = CDockingBarWnd::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
COLORREF m_clrBack;
CBrush m_brush;
if (pWnd->GetDlgCtrlID() == IDC_EDTEXT)
{
m_clrBack = RGB(255,255,255);
pDC->SetBkColor(m_clrBack);
m_brush.CreateSolidBrush(m_clrBack);
return (HBRUSH)m_brush.GetSafeHandle();
}
else return hbr;
PD: Thank you for your help Phil.
|
|
|
|
|
I get the date from my CMonthCalCtrl like this:
CTime CurrentCDate;
CString CurrentSelectedDate;
//Get the currentselected date
KalenderControl2.GetCurSel(CurrentCDate);
CurrentSelectedDate.Format(_T("%02d / %02d / %02d"),CurrentCDate.GetDay(),CurrentCDate.GetMonth(),CurrentCDate.GetYear());
//Put it in a box
SetDlgItemText(IDC_CURRDATE2,CurrentSelectedDate);
This gives me a f***ed up date, days +13 (in win 2000) and days +8, months +3 in win95/98. I need help on this please, what am I doing wrong that the output is wrong?
Thanks in advance,
Tom Cornille
|
|
|
|
|
Hi,
how can i get the active view (or the active document) from a non-modal dialog?
I have tried
CFrameWnd *pFrame=GetParentFrame();
CDocument *pDoc=pFrame->GetActiveDocument();
and
CView *pView=pFrame->GetActiveView();
but both, GetActiveDocument() and GetActiveView() return NULL although there was a document (and therefore a few, too) created.
I'm working with MDI docs/views.
Thanks for your help!
Chris.
|
|
|
|
|
Instead of
CFrameWnd* pFrame = GetParentFrame();
try
CFrameWnd* pFrame = (CFrameWnd*) AfxGetMainWnd();
|
|
|
|
|
I just tried that, but i still get NULL for pFrame->GetActiveView() and GetActiveDocument()!??!
|
|
|
|
|
From MSDN:
[CFrameWnd::GetActiveView ]
"This function returns NULL when called for an MDI main frame window (CMDIFrameWnd). In an MDI application, the MDI main frame window does not have a view associated with it. Instead, each individual child window (CMDIChildWnd) has one or more associated views. The active view in an MDI application can be obtained by first finding the active MDI child window and then finding the active view for that child window."
There is also an example of code.
Cheers,
Paolo.
|
|
|
|
|
- i have downloaded DDK98 and i have VC6.0
- Someone to guide me how to start writing Driver for myself designed PCI Interface Card.
- I have a 128K FIFO on my card and i just want to read/write this FIFO when required.
- Now I have to run my code at Prot. Level 0, to get it done. if u know something 4 me, or the urls on web.
|
|
|
|
|
Hello All,
After I do a FindItem on a CListCtrl, It returns an int. How do I use this int to scroll and hightlight the row to make is visible to the user?
There is a Scroll method but it take a CSize, Do I have to convert the int to CSize?
Thanks,
Tony
|
|
|
|
|
Call CListCtrl::EnsureVisible() to scroll a row into view.
|
|
|
|