|
dellthinker wrote: can you suggest a way i can resolve the matter now
Why you are using if statement ? I dont understand, because Using SendMessage you are populating buffer . May be you can use if statement after SendMessage .
But again, its upon you , what logic to implement.
|
|
|
|
|
Use the if statement after the SendMessage, of course! Then make the ofstream within the if statement. I thought i tried this before, thanx a lot for your suggestion prasad_som. You saved me a lot of trouble!
|
|
|
|
|
You haven't initialized addy to anything. Calling strstr() on it doesn't make sense since you'll be comparing against random data on the stack.
|
|
|
|
|
Hi
I want to write a application(MFC), which can be run in two way
1. Auto run at start up.
2. Manually run by user.
I want to know that, is there any way to identify
whether it is manually running or autorun.I want to impliment some functionality according that in the exe.
Acually i want to impliment this in the InitInstance();
nkb
|
|
|
|
|
aaaan wrote: 1. Auto run at start up.
I'm not sure how it works.
But, can you use command line to identify.
|
|
|
|
|
Hi Prasad
thanks for your replay.
But i donnot know how to use comandline
Can you tell me a little briefly.
Thanks
nkb
|
|
|
|
|
aaaan wrote: But i donnot know how to use comandline
Use GetCommandLine , for getting commnad line parameters.
When running and exe, they are eimmediately followed by exe name.
We can use while running an exe.
c:\\MyExe.exe "prasad"
In example above "prasad" will be passed as parameter to exe. Which can be obtained using GetcommandLine from application.
See description of GetcommandLine for better understanding.
|
|
|
|
|
Well i have been waiting for your replay for the solution for
<br />
ListView_GetItemText(hwndListview,i,0,(LPWSTR)&buff,MAX_PATH);<br />
i had my previous thread i asked you about the following.
i repeat it again.
the follwing is working but for the fetching ListView_GetItemText is not working. please let check our last discussion.
<br />
LRESULT iCount=ListView_GetItemCount(hwndListview); <br />
then i iterate the loop.
<br />
if(iCount > 0)<br />
{<br />
for(int i=0;i<iCount;i++)<br />
{<br />
WCHAR szInputFile[MAX_PATH];<br />
char buff[500];<br />
<br />
<br />
ListView_GetItemText(hwndListview,i,0,(LPWSTR)&buff,MAX_PATH);<br />
std::string buff_input(buff);<br />
<br />
<br />
<br />
<br />
<br />
{<br />
<br />
<br />
if(buff_input == uploadedFile) <br />
{<br />
valid = false;<br />
MessageBox(hDlg,_T("This item is already added to the list."),_T("Encode"),MB_ICONINFORMATION);<br />
break;<br />
}<br />
} <br />
} <br />
}
i have tried to fetch the list view's first o colum strings in so many way
1) i have used string but no result gives ,error
2) using WHAR but when tring to convert it into string. it gives question mark
3)i have used char array but it gives me the result but when i am trying to convert it only convert first char and terminate.
i have checked everything with did debugging.
give me some idea or guid line to avoid the duplication in the list view control.
amit
|
|
|
|
|
amitmistry_petlad wrote: Question is for prasad_som
Should not ask specific person for answer on public forum. Here all good guys are to help you out.
amitmistry_petlad wrote: Well i have been waiting for your replay for the solution for
I've answered your previous post few minutes[^] back.
|
|
|
|
|
What happens when you run ListView_GetItemText and when you want to post your code before post your code use of Preview button
|
|
|
|
|
sorry for the subject name.
Dear whitesky,
i have put but why it takes entire red ?!! i dont know
ok ,
i am working in the existing project the old employee is doing the mix datatype (UNI & ANSI)
and coding and i have some changes in this current.now he had take string
and my output is in wstring. there is comparsion between this two
wstring == string
so i am trying the string into wstring in the following way.
<br />
TCHAR buff[MAX_PATH]={0}; ListView_GetItemText(hwndListview,i,0,(LPWSTR)&buff,MAX_PATH);<br />
std::wstring buff_input(buff);<br />
wchar_t tempupload[MAX_PATH]={0}; wsprintf(tempupload,L"%s",uploadedFile);
std::wstring wstr_upload(tempupload);<br />
if(buff_input.compare(tempupload)!=0)<br />
{<br />
valid = false; MessageBox(hDlg,_T("This item is already added to the list."),_T("Encode"),MB_ICONINFORMATION);<br />
break;<br />
}<br />
is it ok ? when i am debug it tempupload is null
then i have direct put in the following way.
std::wstring tempupload(uploadedFile);
but no fruitful result.
how can i make both compatible type so i can compare both string.
amit
|
|
|
|
|
amitmistry_petlad wrote: wsprintf(tempupload,L"%s",uploadedFile); //this uploadedFile is string
How uploadedFile is declared ? And initialized ?
|
|
|
|
|
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
|
|
|
|
|