|
I have a main (parent) MDI Application that launches another MDI Application. I have altered the title bar in the parent MDI App to display active security colors(all the time). When the child MDI App gets launched, especially when it's position comes up overlapping the parent App, I notice some weirdness with the mouse probably due to confusing framework messages as a result of the always active parent MDI title bar. The mouse will disappear behind the child MDI App window because it thinks it is still owned by the parent MDI App. I have tried to intercept the OnMouseActivate in the child's View class to no success. The parent title bar must stay active per requirements. Anyone know of a way I can relinquish mouse control to this child MDI App?
Thanks!
|
|
|
|
|
i have met the problem with designing a step by step program. can anyone help me with your source code or your ideal of designing a step by step program.
|
|
|
|
|
First you'll need to explain what a "step-by-step program" is.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Dear friendz....
i would like to know hoe i can change the color of the frame of a picture control placed on a dialog box when a certain event(say OnMouseMove())takes place??
all suggestionz are welcome.....
thanx in advance...
|
|
|
|
|
Hi,
I need to remove the lower combo box in a File Dialog (I mean the one which let you choose the file type). I've tried with HideControl(cmb1) where cmb1 is the ID of that combo box, but I can't hide it (the command works with the other two Combo boxes).
Notice: I'm using VS 2003.NET, the File dialog is a bit different from the old one.
Thanks
Vilmer
|
|
|
|
|
I've not tried this exact thing, but have done something similar. Derive a class from CFileDialog . At the end of the OnInitDialog() method, post a message. In the handler for that message, call ShowWindow(..., SW_HIDE) on the control you want to hide.
If you are not using MFC, you can do the same thing using GetOpenFileName() . Just specify a hook procedure in the lpfnHook member variable. In the hook procedure, handle the WM_INITDIALOG by posting the same message as mentioned before.
Hopefully this will solve your problem, or at least point you down the right path.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I usually make my windows forms by chosing the 'Windows Application Form (.Net)' , but this time i chose 'Blank Project (.Net)' instead cus i wanted to make it from scratch. I have no problem making the worms and running it.
The problem is the IntelliSense never works anymore !? How can i fix this?
Thanks in advanced!
(PS: when making forms from blank project, how can i launch the form without launching the console as well?)
|
|
|
|
|
Hello,
For the time being, in a dialog, I have a TabCtrl with several panels.
Each of its panels has a CComboBox but they all have the same content (a list of customer names).
As this content is costly to build (lot of infos extracted from a database plus the filling of the CComboBox), I would like to build this CComboBox only once (i.e. in the OnInitDialog of the dialog containing the TabCtrl) and "share" it between all panels of the TabCtrl.
By "share", I mean : the CComboBox is displayed on each panel I click and I can select from it.
I thought to create a little daughter dialog with my CComboBox, but with the create, I am obliged to give a Parent ...
Any ideas or suggestions will be appreciated.
DD
|
|
|
|
|
this might not even work, it's just an idea. how about creating the combobox as a child of the dialog, not the tab, and see if you can use SetWindowPos() or MoveWindow() , (I can't remember which one uses &wndTopMost ) without changing the size or location, just setting the the Z-order to &wndTopMost . If this doesn't work, I hope it at least gives you another idea.
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Hello,
not bad this idea ... I already had the same ... )
look at my code hereunder :
m_Tab.InsertItem( 0, "Tabnbr1");
m_Tab.InsertItem( 1, "Tabnbr22");
m_pTab1 = new CTab1;
m_pTab1->Create(CTab1::IDD, &m_Tab);
m_pTab1->SetWindowPos(NULL, 4, 28 , 0, 0,SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOZORDER);
m_pTab1->ShowWindow(SW_SHOW);
//
m_pTab2 = new CTab2;
m_pTab2->Create(CTab2::IDD, &m_Tab);
m_pTab2->SetWindowPos(NULL, 4, 28 , 0, 0,SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOZORDER);
m_pTab2->ShowWindow(SW_HIDE);
//
m_pDialogListe = new CTestDialogListe;
m_pDialogListe->Create(CTestDialogListe::IDD, &m_Tab); // solution1
m_pDialogListe->Create(CTestDialogListe::IDD, (CWnd*) m_pTab1); // solution2
m_pDialogListe->Create(CTestDialogListe::IDD, NULL);
m_pDialogListe->SetWindowPos(NULL, 4, 28 , 0, 0,SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOZORDER);
m_pDialogListe->ShowWindow(SW_SHOW);
As you can see, when we create the doughter dialog with the combo box in, we are obliged to give a parent.
If I give the Tab (solution1) as parent : ok, the combo is displayed on every panels, but is not accessable from any of the 2 panels.
If I give the panel1 (solution2) as parent : ok, the combo is displayed on panel1 and it works, but is even not displayed on panel 2. Is there a solution to make it appear and make it work on panel 2?
Thanks your your answer
DD
|
|
|
|
|
Each panel should have its own combobox. If the populating of the combobox is expensive (e.g., querying a database), you can put the data (e.g., list) in the dialog instead. Then as each panel is activated, the data can be quickly pulled from the dialog's data structure rather than from an external source. Make sense?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello,
<each panel="" should="" have="" its="" own="" combobox="">
that's what all my trials seem to proove ... (
<you can="" put="" the="" data="" (e.g.,="" list)="" in="" dialog="" instead="">
what do you mean by "in the dialog instead" ?
the dialog with the tab is not permanent, there is a general menu above that calls this dialog-Tab when I need it, and when I return to general menu, all this stuff is destroyed.
Effectively, maybe I should make the extraction from DB once at the launch of the application, save the result in a global list, and fill every combos from this list. Remain the problem to synchonize this list with the DB ...
Why not ... if I don't find another solution
Thanks
DD
|
|
|
|
|
qadddd_free wrote:
what do you mean by "in the dialog instead" ?
I assumed that the parent/owner window of the tab control was a dialog.
qadddd_free wrote:
Remain the problem to synchonize this list with the DB ...
If you are just reading from the database, what needs to be synchronized?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hello,
It is the case
<if you="" are="" just="" reading="" from="" the="" database,="" what="" needs="" to="" be="" synchronized?="">
I am reading from the database but this application is planned to be used by several users able to change the content of the tables I am reading, so I have to synchronize my list with eventual new records or with record content that have been changed
Regards
DD
|
|
|
|
|
Then you are obviously going to have to requery the database each time. That is the only way to get updated records.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Disable network.
A com solution
<br />
#define _WIN32_WINNT 0x0502<br />
<br />
#include <windows.h><br />
#include <stdio.h><br />
#include <objbase.h><br />
#include <netcon.h><br />
<br />
#define CheckHR(info) \<br />
{ \<br />
HRESULT hr = (info); \<br />
if(FAILED(hr)) \<br />
{ \<br />
if ( hr != 0x800704D5 ) \<br />
{ \<br />
printf("ERROR"); \<br />
exit(1); \<br />
} \<br />
}\<br />
}<br />
<br />
<br />
typedef enum<br />
{<br />
DISABLE = 0,
ENABLE = 1,
PORT_STATUS = 2,
LINK_STATUS = 3,
ENDIS_PORT = 4
}PORTSTATUS;<br />
<br />
<br />
<br />
void main(int argc, char** argv)<br />
{<br />
INetConnectionManager* pManager;<br />
INetConnection* pConnection;<br />
IEnumNetConnection* pEnum;<br />
INetConnectionConnectUi* pConnectionUI;<br />
<br />
ULONG celtFetched;<br />
<br />
BOOL bFoundInterface = FALSE;<br />
int nPortStatus = -1;<br />
int nCmd = -1;<br />
wchar_t ifname[100];<br />
<br />
<br />
if (argc <= 2 )<br />
{<br />
printf("ERROR");<br />
return;<br />
}<br />
<br />
swprintf(ifname,L"%S",argv[1]);
nCmd = atoi(argv[2]);
if ( argc == 4 )<br />
{<br />
nPortStatus = ( argv[3][0] == '1' ) ? 1:0 ;
}<br />
<br />
<br />
CheckHR( CoInitialize(NULL) );<br />
CheckHR( CoCreateInstance(CLSID_ConnectionManager, NULL, CLSCTX_SERVER, IID_INetConnectionManager, (void**)&pManager) );<br />
CheckHR( pManager->EnumConnections(NCME_DEFAULT, &pEnum) );<br />
pManager->Release();<br />
<br />
while( pEnum->Next(1, &pConnection, &celtFetched) == S_OK )<br />
{<br />
NETCON_PROPERTIES* properties;<br />
CheckHR( pConnection->GetProperties(&properties) );<br />
if ( (wcscmp(properties->pszwName,ifname)) == 0 )<br />
{<br />
bFoundInterface = TRUE;<br />
switch(nCmd)<br />
{<br />
case PORT_STATUS:<br />
case LINK_STATUS:<br />
{<br />
switch(properties->Status)<br />
{<br />
case NCS_DISCONNECTED:<br />
case NCS_DISCONNECTING:<br />
case NCS_HARDWARE_NOT_PRESENT:<br />
case NCS_HARDWARE_DISABLED:<br />
case NCS_HARDWARE_MALFUNCTION:<br />
case NCS_AUTHENTICATION_FAILED:<br />
case NCS_INVALID_ADDRESS:<br />
case NCS_CREDENTIALS_REQUIRED:<br />
printf("Port is not Functioning");<br />
break;<br />
case NCS_CONNECTED:<br />
{<br />
if ( nCmd == PORT_STATUS )<br />
printf("Port is UP");<br />
else<br />
printf("Link is UP");<br />
}<br />
break;<br />
case NCS_MEDIA_DISCONNECTED:<br />
printf("MEDIADISCONNECTED");<br />
break;<br />
default:<br />
printf("ERROR");<br />
break;<br />
}<br />
}<br />
break;<br />
case ENDIS_PORT:<br />
{<br />
switch(nPortStatus)<br />
{<br />
case DISABLE:<br />
{<br />
if(SUCCEEDED(pConnection->QueryInterface(IID_INetConnectionConnectUi, (void**)pConnectionUI)))<br />
{<br />
pConnectionUI->SetConnection(pConnection);<br />
pConnectionUI->Disconnect(NULL, NCUC_NO_UI);<br />
pConnectionUI->Release();<br />
}<br />
else<br />
{<br />
CheckHR( pConnection->Disconnect() );<br />
}<br />
}<br />
break;<br />
case ENABLE:<br />
{<br />
if(SUCCEEDED(pConnection->QueryInterface(IID_INetConnectionConnectUi, (void**)pConnectionUI)))<br />
{<br />
pConnectionUI->SetConnection(pConnection);<br />
pConnectionUI->Connect(NULL, NCUC_NO_UI);<br />
pConnectionUI->Release();<br />
}<br />
else<br />
{<br />
CheckHR( pConnection->Connect() );<br />
}<br />
}<br />
break;<br />
default:<br />
printf("ERROR");<br />
break;<br />
}<br />
}<br />
break;<br />
default:<br />
printf("ERROR");<br />
break;<br />
}<br />
CoTaskMemFree(properties);<br />
pConnection->Release();<br />
break;<br />
}<br />
else<br />
{<br />
CoTaskMemFree(properties);<br />
pConnection->Release();<br />
continue;<br />
}<br />
}<br />
if ( !bFoundInterface )<br />
printf("ERROR");<br />
<br />
pEnum->Release();<br />
CoUninitialize();<br />
}<br />
<br />
There is no spoon.
mail
|
|
|
|
|
How to create Device Driver for win 2000.This driver must support all peripheral devices.
|
|
|
|
|
DDK(Device Driver Kit) has a lot of help and samples regarding this.
There is no spoon.
mail
|
|
|
|
|
Hi,
one stupid question:
I need to know the handle of the main dialog created by the MFC Wizzard (dialog based app). How to get that? I am confused that I couldnt find anything about it. I am using this for a class for minimizing the app to the tray.
Do this dialogs have a handle?
DKT
|
|
|
|
|
CWnd::m_hWnd
CDialog is derived from CWnd, so you can access m_hwnd from CDialog or through CDialog !
There is no spoon.
mail
|
|
|
|
|
Thank you!
Thats it!
Btw, why cant I see this member variable in the ClassWizzard? I just see my own vars...
DKT
|
|
|
|
|
I think if you saw every inherited function and variable from all the parent classes, classwizard would be almost useless.
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Kreatief wrote:
I am using this for a class for minimizing the app to the tray.
You use Shell_NotifyIcon() for this. There are plenty of examples on how to do this here at CP, and on MSDN. You can Google for even more.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yeah sure. I did that, and got it to work. I am having other problems with the trayicon, which caused the problem! I have an MFC app, where I wanna handle Messages, eg. a Buttonclick on the icon. I dunno how to do that. Who can tell me just the base. I can learn myself, but I need to know the base. For a normal app you make an endless loop checking for messages. But here?
DKT
|
|
|
|
|
ok....tis a long story.....here goes......
u c.....the code.....
HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR1 );
SetCursor( hIcon );
return TRUE;
is a working code coz i have put this in my Dialog based application (Xyz) in a class called CXyzDlg..... that is, i have already added this function "OnSetCursor()".....and the cursor changes......in the main Dlg box but..... i have derived a class from the CStatic Class named it as "CMyClass".....and i have created obcts of it in the CXyzDlg class.....basically these objects i have created by placing the "static control" on the dialog box and then..... thru the class wizard created an object linking it with the picture control of type CMyClass(that is .....SUBCLASSING).....
also in thiz CMyClass i have added the "OnSetCursor()" function as well......and many other mouse functions like "onmousemove()","LbuttonDown()".....etc.....but here when i put in the same code as i had put in the main Dlg box for the "OnsetCursor()".....it does not change!!!!!......y???
heres the code......that i have put in the derived class CMyClass......
<br />
#include "stdafx.h"<br />
#include "creamz.h"<br />
#include "MyClass.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
<br />
CMyClass::CMyClass()<br />
{<br />
m_DragOn1=FALSE;<br />
m_pot1=0;<br />
m_update=TRUE;<br />
}<br />
<br />
CMyClass::~CMyClass()<br />
{<br />
}<br />
<br />
<br />
BEGIN_MESSAGE_MAP(CMyClass, CStatic)<br />
ON_WM_LBUTTONDOWN()<br />
ON_WM_LBUTTONUP()<br />
ON_WM_MOUSEMOVE()<br />
ON_WM_SETCURSOR()<br />
END_MESSAGE_MAP()<br />
<br />
<br />
void CMyClass::OnLButtonDown(UINT nFlags, CPoint point) <br />
{<br />
<br />
HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR2 );<br />
SetCursor( hIcon );<br />
m_DragOn1=TRUE;<br />
<br />
<br />
CStatic::OnLButtonDown(nFlags, point);<br />
}<br />
<br />
void CMyClass::OnLButtonUp(UINT nFlags, CPoint point) <br />
{<br />
<br />
HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR1 );<br />
SetCursor( hIcon );<br />
m_DragOn1=FALSE;<br />
<br />
<br />
CStatic::OnLButtonUp(nFlags, point);<br />
}<br />
<br />
void CMyClass::onmousemove(UINT nFlags, CPoint point) <br />
{<br />
<br />
<br />
if(m_DragOn1==TRUE)<br />
{<br />
<br />
if(m_pot1<62)<br />
m_pot1+=1;<br />
else<br />
m_pot1=0;<br />
<br />
if(m_pot1%2==0)<br />
m_update=TRUE;<br />
<br />
}
<br />
<br />
<br />
<br />
CStatic::onmousemove(nFlags, point);<br />
}<br />
<br />
BOOL CMyClass::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) <br />
{<br />
<br />
if(m_DragOn1==FALSE)<br />
{<br />
<br />
<br />
HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR1 );<br />
SetCursor( hIcon );<br />
}<br />
else<br />
{<br />
HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR2 );<br />
SetCursor( hIcon );<br />
} <br />
<br />
<br />
return TRUE;<br />
<br />
<br />
}
plz help me out......
thanx in advance.....and thanx for ur intrest!!!!!
|
|
|
|
|