|
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!!!!!
|
|
|
|
|
How can I convert an _int64 variable to double?
|
|
|
|
|
How about:
__int64 i64;
double d = (__int64) i64; If you are using the .NET framework, check out the Convert.ToDouble() method.
Another way would be like:
__int64 i64;
char s[32];
sprintf(s, "%I64d", i64);
double d = atof(s); I've not explicitly tried either of these.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
How can I turn off all network traffic and then later turn it on again.
Regards
Tobias
|
|
|
|
|
A fixed font should allow 80 columns across a screen. However this doesn't quite fit when there are standard borders around the window when viewed in maximized mode.
Can anyone suggest how I can display a window, based on CScrollView, which does not have the normal side borders. Either no border or a very narrow border.
All suggestions appreciated.
Sara
|
|
|
|
|
Hi,
I want to write an application.
I want to hide it in Task List on Windows 9x/Me.
Please help me !
Thanks.
|
|
|
|
|
Does ShowWindow(..., SW_HIDE) not do what you want?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I use ShowWindow(..., SW_HIDE).
It will be hidden. But It will be shown in Task List.
I don't know the way to hide it in Task List.
|
|
|
|
|
I do not know of a way to hide processes (those items on the Processes tab) shown by Task Manager. Why do you need this functionality?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I want to write an application which run in background. And it cannot be killed by anyway.
Do you know the way to do this ?
|
|
|
|
|
chauhoangtrung wrote:
I want to write an application which run in background.
"Run in background" is a phrase not used with Windows since it is a multitasking OS.
chauhoangtrung wrote:
And it cannot be killed by anyway.
This sounds very suspicious. Can you explain why this should not be considered a virus, worm, or trojan horse?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Have you seen EasyCafe, an application to manage PC room ? I want to write an application same it.
When I use Ctrl+Alt+Del to show Task Manager, I don't see it in Task Manager. So I cannot kill it.
|
|
|
|