|
i have done it with following code and its now working.
<br />
TCHAR buff[MAX_PATH]={0}; ListView_GetItemText(hwndListbox,i,0,(LPWSTR)&buff,MAX_PATH); std::wstring buff_input(buff); <br />
std::wstring wstr_upload(uploadedFile.begin(),uploadedFile.end()); int k=buff_input.compare(wstr_upload);<br />
thank you for replay me.
can u solve one more?
how can i set default value in combobox?
amit
|
|
|
|
|
amitmistry_petlad wrote: how can i set default value in combobox?
Can you explain in detail, what you want to do ?
|
|
|
|
|
i want to display the combo with selected value(index 0) at time of dialog intialize.
callback EncodeProc call, when user click on button
<br />
LRESULT CALLBACK EncodeProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)<br />
{<br />
string FileCombo[] = { "Please select files to add", "Add files", "Add folders"}; <br />
string QuiltityCombo[]={ "Best", "Middle", "Low"}; <br />
.<br />
. <br />
.<br />
.<br />
. <br />
<br />
switch(message) <br />
<br />
{<br />
<br />
case WM_INITDIALOG:<br />
hWndComboBox=GetDlgItem(hDlg,IDC_FILECOMBO); <br />
if( !hWndComboBox )<br />
{<br />
return FALSE;<br />
}<br />
<br />
for(int i=0;i<3;i++)<br />
{<br />
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,ComboBoxItems[i].c_str() ,(int)(ComboBoxItems[i].length() + 1),w_combolist,MAX_PATH);<br />
SendMessage(hWndComboBox,CB_ADDSTRING,0,(LPARAM)w_combolist);<br />
}<br />
SendMessage(hWndComboBox, LB_SETCURSEL,0, 0L ); <br />
<br />
hWndQulatiComboBox=GetDlgItem(hDlg,IDC_QULALITY_COMBO); <br />
if(!hWndQulatiComboBox)<br />
{<br />
return FALSE;<br />
} <br />
for(i=0;i<3;i++)<br />
{<br />
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,QuiltityComboBoxItems[i].c_str() ,(int)(QuiltityComboBoxItems[i].length() + 1),w_combolist,MAX_PATH);<br />
SendMessage(hWndQulatiComboBox,CB_ADDSTRING,0,(LPARAM)w_combolist); <br />
}<br />
SendMessage(hWndComboBox, LB_SETCURSEL,0, 0L ); <br />
<br />
break;<br />
<br />
1)
so when user click on button ,index zero is intialzed in combo with value
"Please select files to add" in first combobox
and
second "Best" in other combobox
2) parent/child combo box
third combo is parent, filled with some values come from external source
that i also want to intialze index 0 and on the base of this parent combo
there is one child combo fill by this parent which has also filled by external
source.
for the (2) I have total coding how the code come from external source.
amit
|
|
|
|
|
Then whats the problem ? You are using LB_SETCURSEL , which seems to be correct to me. Use CB_SETCURSEL .
-- modified at 5:18 Thursday 28th December, 2006
|
|
|
|
|
Then why its not dispaly the first zero index value in the combobox?
|
|
|
|
|
You have used LB_SETCURSEL instead of CB_SETCURSEL in SendMessage . Correct that.
|
|
|
|
|
Marvelous!!!!
Genius!!!!!
Your my Master!!!!
Thank you.
|
|
|
|
|
hi, i am indonesian, poor in english (*.*; )
how to adding image/icon on bar menu (command bar) for windows mobile using MFC ??
thanks before V(^ ^)
death by chocolate ^ ^
|
|
|
|
|
eantaru wrote: death by chocolate ^ ^
Good one
"I'd like to help but I don't feel like Googling it for you."
|
|
|
|
|
hehehehe, i like chocolate
|
|
|
|
|
Hi, I'm invoking ShellExecuteEx to launch another exe from my console application - the problem is, the call returns before the executing process is completed. Is there any way to get around this?
<br />
::ZeroMemory(&shellInfo, sizeof(shellInfo));<br />
<br />
shellInfo.cbSize = sizeof(shellInfo);<br />
shellInfo.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS;<br />
shellInfo.lpFile = csCommand;<br />
shellInfo.lpParameters = csArgument;<br />
shellInfo.nShow = SW_HIDE;<br />
shellInfo.hMonitor = <br />
<br />
if (ShellExecuteEx(&shellInfo))<br />
{<br />
if (shellInfo.hProcess)<br />
{<br />
hProcess = shellInfo.hProcess;<br />
<br />
bSuccess = TRUE;<br />
}<br />
else<br />
{<br />
bSuccess = FALSE;<br />
}<br />
}<br />
else<br />
{<br />
bSuccess = FALSE;<br />
}
Thanks.
Norman Fung
|
|
|
|
|
Try searching for:
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
This should wait until it finishes.
Roy
|
|
|
|
|
if (shellInfo.hProcess)
{
hProcess = shellInfo.hProcess;
::WaitForSingleObject(hProcess, INFINITE);
*EDIT* Sorry baloneyman! I missed it by a minute
|
|
|
|
|
check the _cwait() function in msdn ... it includes an example
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
Solution here
<br />
BOOL bSuccess = TRUE;<br />
<br />
STARTUPINFO si = { sizeof(si) };<br />
PROCESS_INFORMATION pi;<br />
<br />
CString csCommand;<br />
CString csArgument;<br />
<br />
csCommand = strIsqlPath;<br />
<br />
csArgument = csCommand;<br />
csArgument += L" -U ";<br />
csArgument += strDBUsername;<br />
<br />
if(!strDBPassword.IsEmpty()) {<br />
csArgument += L" -P ";<br />
csArgument += strDBPassword;<br />
}<br />
<br />
csArgument += L" -S ";<br />
csArgument += strSourceServer;<br />
<br />
csArgument += L" -s, -w2500";<br />
<br />
csArgument += L" -i \"";<br />
csArgument += strSQLCmdPath;<br />
csArgument += L"\"";<br />
<br />
csArgument += L" -o \"";<br />
csArgument += strTradeExtractFilePath;<br />
csArgument += L"\"";<br />
<br />
try {<br />
<br />
if(<br />
CreateProcess(<br />
NULL,<br />
csArgument.GetBuffer(csArgument.GetLength()),<br />
NULL,<br />
NULL,<br />
NULL,<br />
NULL,<br />
NULL,<br />
NULL,<br />
&si,<br />
&pi<br />
)<br />
) {<br />
WaitForSingleObject(pi.hProcess, INFINITE);<br />
<br />
CloseHandle(pi.hProcess);<br />
CloseHandle(pi.hThread);<br />
}<br />
<br />
<br />
} catch(CException ex) {<br />
bSuccess = FALSE;<br />
ex.GetErrorMessage(errMsg, 0, NULL);<br />
}<br />
<br />
return bSuccess;<br />
-- modified at 20:36 Wednesday 27th December, 2006
Norman Fung
|
|
|
|
|
Hello everyone,
I want to write a program that gets input from the microphone. The volume of the input from the microphone will be used in a program. Based on the volume of the input, I want to increase the size of another variable.
Can anyone help with me this? where do I start from?
Thanks a million in advance.
Commickey
|
|
|
|
|
Commickey wrote: where do I start from?
Have you already decided to go with the Windows waveform audio system (waveIn, waveOut)?
If not, I would recommend examining the pros and cons of the different audio options:
For MCI and waveform audio there's
Windows Multimedia[^]
For DirectX (DirectSound) there's
DirectX SDK[^]
|
|
|
|
|
Thanks alot... I will consider ur suggestions...
Greetings,
Commickey
|
|
|
|
|
Is MCI_DGV_RECORD_PARMS helpfuls ?
|
|
|
|
|
I have an application with a main processing loop ( while(true){} ). When the application is running normally it eats up about 2% of the CPU. Whenever focus is taken away from the application window however, the CPU usage jumps to about 50%. This also happens when I comment out all of my code in the loop except the windows message queue processing and my app jumps from 60fps to about 2000fps.
My question is, how do I 'pause' processing when focus is taken away, but still have the abilty to get window messages so I know when focus is given back?
Thanks in advance,
Dustin
|
|
|
|
|
When your application receives the WM_KILLFOCUS message then set the thread priority to BelowNormal or Lowest or make the application thread sleep.
Hope it helps
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
That doesn't seem to work.
Am I doing this correctly? I have never created/manipulated threads before.
case WM_ACTIVATE:
{
if (LOWORD(wParam) == WA_ACTIVE)
{
HANDLE thread = GetCurrentThread();
SetThreadPriority(thread, THREAD_PRIORITY_NORMAL);
}
else
{
HANDLE thread = GetCurrentThread();
SetThreadPriority(thread, THREAD_PRIORITY_LOWEST);
}
}
break;
I also tried doing it on the WM_KILLFOCUS event but with the same results.
Thanks,
Dustin
|
|
|
|
|
Something i forgot when you posted was that you wanted to pause the processing not lower it.
try this if it does not work try send me an demo so i can test.
static bool g_bRunning = true;
case WM_ACTIVATE:
{
if (LOWORD(wParam) == WA_ACTIVE)
{
g_bRunning = true;
}
else
{
g_bRunning = false;
}
}
break;
while (!g_bRunning){};
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
Since my message peek is in the main loop, if I do that it will no longer look for messages and will not tell me when focus has been restored.
|
|
|
|
|
Well you could put a copy of the messagepeek functions to the while (!m_bRunning) {<here>}; then there should be no problems
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|