|
Hi fren,
i am not sure how to link the related comboBox in the C++. Actually i would like the comboBox related in this way, such as the 1st combobox may consist the data called Food, Beverage. Then i wan the 2nd combo box will consist the data which is link to the selection of the 1st combobox. that's mean if user select Food, my 2nd combobox will onli list out- sandwiches, pasta, etc. wherelese if user select beverage will list out - coffee, coke,etc.
Hope u get what i mean. Thanks for your help!!!
|
|
|
|
|
One solution is to design an algorithm and update the controls manually.
Kuphryn
|
|
|
|
|
Is it i should use a event called OnselendokTypeDetail?? in this event i will retrieve the data from the database and assign it to combobox2 when the user have selected the data from combobox1 such as:
m_TypeDetail.Execute(0,1, T_("Select TypeDetailId, Description From tbl_TypeDetail where TypeId = %dcb",) &m_Type);
combox1 member variable = m_Type, combobox2 member variable = m_TypeDetail
|
|
|
|
|
How do I embed and use a font resource in application?
Please send a sample.
Thanks.
|
|
|
|
|
You can create binary resources that are basically the contents of a LOGFONT structure. When you need to create the font, you will need to load the resource and call CreateFontIndirect, passing the logfont pointer.
onwards and upwards...
|
|
|
|
|
Did you ever get this working?
Cheers
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
hi, i try to play around with ON_UPDATE_COMMAND_UI but i didn't get wat i want
i put the following macro in my message map:
===
ON_COMMAND(ID_FACEREDETECTION_DISABLE, OnFaceredetectionDisable)
ON_UPDATE_COMMAND_UI(ID_FACEREDETECTION_DISABLE, OnUpdateFaceredetectionDisable)
===
void CXFaceRecognitionDlg::OnUpdateFaceredetectionDisable(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
MessageBox("OnUpdateFaceredetectionDisable", "OnUpdateFaceredetectionDisable", MB_OK);
pCmdUI->SetText ("New Text");
}
when i click on that menu, i get the message box. however, the text of the menu won't change ??
can anyone tell me why this happen??
thank you.
regards
yccheok
p/s ya. i am developing dialog based application and i just add the menu by manually editing the resource file.
====
IDD_XFACERECOGNITION_DIALOG DIALOGEX 0, 0, 299, 263
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "FaceRecognition .NET"
MENU IDR_MENU1
===
|
|
|
|
|
Here is one solution from MSDN.
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B242577
Kuphryn
|
|
|
|
|
Add a handler for WM_KICKIDLE to your msg map (it's not in ClassWizard since it's an undocumented MFC message, so you'll need to edit the msg map manually). You may need to #include afxpriv.h to get the definition of WM_KICKIDLE . In the handler, call UpdateDialogControls(this, false);
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Wow, this is an old reply, but thanks for posting this.
|
|
|
|
|
Hi,
In my program, I use asynchronies dial up connection with rasapi32 api.
From RasDialFunc, after RASCS_AuthNotify, I can’t get any other message.
Anybody knows why this happens?
Here is my RasDialFunc code.
VOID WINAPI RasDialFunc(UINT unMsg, RASCONNSTATE rasconnstate, DWORD dwError)
{
if ( dwError )
{
char szBuf[256];
if ( RasGetErrorString( dwError, (LPSTR)szBuf, 256 ) != 0 )
{
wsprintf( (LPSTR)szBuf, "Undefined RAS Dial Error (%ld).", dwError );
RasHangUp( g_hRasConn );
MessageBox(NULL, (LPSTR)szBuf, "Agni Dialer", MB_OK | MB_ICONSTOP );
}
return;
}
g_nLastRASConnState = rasconnstate;
LPCTSTR lpszMsg;
switch ( rasconnstate )
{
case RASCS_OpenPort : lpszMsg = "Openning Port"; break;
case RASCS_PortOpened : lpszMsg = "Port Opened"; break;
case RASCS_ConnectDevice : lpszMsg = "Connecting Device"; break;
case RASCS_DeviceConnected : lpszMsg = "Device Connected"; break;
case RASCS_AllDevicesConnected : lpszMsg = "All Devices Connected"; break;
case RASCS_Authenticate : lpszMsg = "Starting Authentication"; break;
case RASCS_AuthNotify : lpszMsg = "Authentication Notify"; break;
case RASCS_AuthRetry : lpszMsg = "Authentication Retry"; break;
case RASCS_AuthCallback : lpszMsg = "Callback Requested"; break;
case RASCS_AuthChangePassword : lpszMsg = "Change Password Requested"; break;
case RASCS_AuthProject : lpszMsg = "Projection Phase Started"; break;
case RASCS_AuthLinkSpeed : lpszMsg = "Link Speed Calculation"; break;
case RASCS_AuthAck : lpszMsg = "Authentication Acknowledged"; break;
case RASCS_ReAuthenticate : lpszMsg = "Reauthenticatation Started"; break;
case RASCS_Authenticated : lpszMsg = "Authenticated"; break;
case RASCS_PrepareForCallback : lpszMsg = "Preparation For Callback"; break;
case RASCS_WaitForModemReset : lpszMsg = "Waiting For Modem Reset"; break;
case RASCS_WaitForCallback : lpszMsg = "Waiting For Callback"; break;
case RASCS_Interactive : lpszMsg = "Interactive"; break;
case RASCS_RetryAuthentication : lpszMsg = "Retry Authentication"; break;
case RASCS_CallbackSetByCaller : lpszMsg = "Callback Set By Caller"; break;
case RASCS_PasswordExpired : lpszMsg = "Password Expired"; break;
case RASCS_Disconnected : lpszMsg = "Disconnected"; break;
case RASCS_Connected : lpszMsg = "Connected"; break;
}
g_csStatusMsg = lpszMsg;
}
|
|
|
|
|
MUuu..
Kuniva
--------------------------------------------
|
|
|
|
|
I've been reading Code Project for quite some time now, and this is the first question I've posted. I'm hoping the collective brain power here can help me track down a problem I'm having.
I have an application (written by me) that seems to be causing the windows clock (but not the RTC) to drift forward in time severely (say 24 seconds over 5 minutes) The application has a number of threads (maybe around 10) and services many TCP connections where the input/response packets are relatively small (90bytes to 1500 bytes)
I am at a loss to think what would make an application cause the windows clock to GAIN time. The processor utilization stays fairly low (below 30%) and it does not consume other resources at an unexpected rate. I was thinking maybe Windows is missing the time update interrupt and over compensating, but I don't believe this is true...
The truly odd thing is that I have a couple of other apps that do very similar tasks which share all the underlying code that this app does, which do NOT cause this problem.
Can anyone think of what to look for, or what to try to narrow the problem down?
Thanks,
Gavin Stark
|
|
|
|
|
I know this is going to sound off the wall, but are you using any sort of memory mapped files in this program? I've heard of cases where improper writing to mem-mapped strange problems. It would be a starting point...
It's good to see kids turning their minds to wholesum activities such as programming, instead of wasting their lives in the hedonistic disciplines of Sex, Drugs, & Rock & Roll... or Sex with Drugs, or Sex with Rocks while Rolling in Drugs, or whatever new-fangled perversions you little monsters have thought up now...
[Shog9 on Kid Programmers]
|
|
|
|
|
Nope, but thanks for the suggestion. What is truly odd, is that the problem happens only on SOME machines. They are all running W2K SP2. Some are single processor PIIIs, others are dual processor Xeons. However, another machine (an Althon 1900+) doesn't seem to be able to replicate the problem. (Although it is running SP3) Odd...
|
|
|
|
|
Turns out this problem only seems to occur on dual processor or dual processor CAPABLE machines. I have generated some sample code which exhibits the problem. If anyone can tell me why this happens or if there is a "workaround" which doesn't involve changing code, I'd be grateful. I do know that one change that makes this work is calling timeBeginPeriod/timeEndPeriod ONCE per instance of the application rather than repeatedly, but I can't change the code in question.
Sample code at:
http://gstark.home.mindspring.com/MultiMediaTimerBug.cpp [^]
#pragma comment( lib, "Winmm.lib" )
#include <process.h>
#include <windows.h>
#include <stdio.h>
const UINT kSleepyTimeMilliseconds = 300;
void CALLBACK Win32MultiMediaTimerProc(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
}
unsigned __stdcall Win32_MyThreadProcStdC(void* threadInput_i)
{
while( TRUE )
{
MMRESULT result;
TIMECAPS timeCapabilities;
result = ::timeGetDevCaps(&timeCapabilities,sizeof(timeCapabilities));
if (result != TIMERR_NOERROR)
return 0;
UINT myWin32TimerResolution = timeCapabilities.wPeriodMin;
if (timeCapabilities.wPeriodMax < myWin32TimerResolution)
myWin32TimerResolution = timeCapabilities.wPeriodMax;
if (myWin32TimerResolution < 1)
myWin32TimerResolution = 1;
result = ::timeBeginPeriod(myWin32TimerResolution);
register UINT timerOptions = TIME_CALLBACK_FUNCTION
| TIME_PERIODIC;
MMRESULT myWin32MultiMediaTimerID = ::timeSetEvent(
(UINT)500,
myWin32TimerResolution,
Win32MultiMediaTimerProc,
(DWORD)0,
timerOptions
);
DWORD lastWin32Error = ::GetLastError();
FILE* f = fopen( "trashFile","w");
if( f )
{
fprintf(f, "trash\n" );
fclose(f);
}
::Sleep( kSleepyTimeMilliseconds );
for( UINT i = 0; i < kSleepyTimeMilliseconds; i++ )
{
::Sleep( 0 );
}
result = ::timeKillEvent( myWin32MultiMediaTimerID );
lastWin32Error = ::GetLastError();
UINT killRetryCount = 3;
while( ( result != TIMERR_NOERROR )
&& ( killRetryCount > 0 ) )
{
::Sleep(0);
result = ::timeKillEvent( myWin32MultiMediaTimerID );
lastWin32Error = ::GetLastError();
if( ( result != TIMERR_NOERROR )
&& ( lastWin32Error == ERROR_ALREADY_EXISTS ) )
{
result = TIMERR_NOERROR;
lastWin32Error = 0;
}
killRetryCount--;
}
switch (result)
{
case TIMERR_NOERROR:
break;
case MMSYSERR_INVALPARAM:
return 0;
case TIMERR_NOCANDO:
break;
default:
break;
}
result = ::timeEndPeriod(myWin32TimerResolution);
::Sleep( kSleepyTimeMilliseconds );
}
}
void ThreadTest()
{
const UINT kNumberThreads = 10;
for( UINT i = 0; i < kNumberThreads; i++ )
{
unsigned threadID;
const unsigned long threadResult = _beginthreadex(
NULL,
0,
Win32_MyThreadProcStdC,
NULL,
0,
&threadID
);
}
while( TRUE )
{
::Sleep( 1000 );
}
}
int main(int argumentCount_i,
const char* const argumentValueArray_i[])
{
ThreadTest();
return 0;
}
|
|
|
|
|
Hi,
Let say I have a VC++ application and try to retrieve a data from an external "c:\file.mdb":
- Its Password is: PASSWORD
- It has two tables: Table1, Table2
- In Table1: it has two column titles: ID, Data
After I use:
<br />
CDaoDatabase *pdb;<br />
<br />
pdb = new CDaoDatabase; <br />
pdb->Open ("c:\file.mdb", FALSE, FALSE, ";PWD = PASSWORD");<br />
How can I retrieve in Table1 the Data at a specific row by knowing the its ID, by the way let assume all fields are Text
Anyone can help me?
Many thanks
|
|
|
|
|
You are asking if you can open the file using C (not the database driver / server) or whatever language and search for the ID?
John
|
|
|
|
|
Hi,
I am using Visual C++ 6.0 project and through it I am trying to open a MicroSoft Access database file.mdb of an existed database from someone esle ... but I do know its environment (I do not have its class in my project)
*) Please verify my original request, it has more detail
Thanks
|
|
|
|
|
Hi all,
please see the code below:
//add single doc template
..........
//process command line
CNewCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if(!cmdInfo.m_bHasTasks)
{
m_pMainWnd->ShowWindow(SW_SHOWNORMAL);
m_pMainWnd->UpdateWindow();
}
else
{
m_pMainWnd->ShowWindow(SW_HIDE);
DoCommandLine(cmdInfo);
return FALSE;
}
Here, when i call showindow(SW_HIDE), the window first appears and then disappears. How can i prevent this flicker ? I must create the window BTW.
regards
hari
Hari Krishnan
|
|
|
|
|
For example,
Class CA{
...
int m_member;
...
}
Class CB{
instance=new CA;
}
Now I want to get CA.m_member's pointer in Class CB, how should I do?
|
|
|
|
|
int* p = &(instance.m_member);
John
|
|
|
|
|
It is wrong.
Don't add "&()";
Only add (*int) in advance.
that is:
(int *)CA.member
|
|
|
|
|
That is a cast operator, not the address of operator.
&CA.member is correct.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
I'm going to patent thought. I have yet to see any prior art.
How true in this case
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|