|
It returns "1".
Dunno what that means but shout mean that item 1 has been selected, right?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hmmm, looks like it's doing the right thing.
Have you tried selecting (i.e. setting focus to) the window containing the list box after you do the SendMessage() ? Does it show the highlighted item when you do that?
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
It automatically gets focus after it has been launched through ShellExecute
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I just found a very strange behavior:
If I start my app for the first time, the item does not get selected in the listbox of the app.
But if I start my app for a second time (and therefore my program starts the other program again so that two instances are running), then suddenly the item gets selected, but only in the first (!) instance of the other app.
What's going on?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Can you use Spy++ to check if your listbox actually receives LB_SETCURSEL?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I never used Spy++ before, could you shortly explain where I can check for incoming messages in other applications?
thanks
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Ctrl+F, then drag 'target' icon on the listbox window. You'll be able to choose between examining properties of the window and hooking into its messages.
BTW: you're calling ShellExecute, then immediately follow with SendMessage? Or there's some other event, like button press which is used to invoked SendMessage with LB_SETCURSEL?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
SendMessage is called within the EnumChildWindows-Callback,which is directly called after ShellExecute. But there's no problem with e.g. LB_GETCOUNT, this works quite well
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Well, while it's not guaranteed to solve your problems, you may try to add WaitForInputIdle call between ShellExecute and EnumChildWindows to avoid dependencies in startup time of second application.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
How do I get a HANDLE of the other app?
Is WaitForInputIdle((HANDLE)wnd,INFINTE) legal?
This did not solve my problems, but you might take a look at my comment "Just found strange behavior" I hope you understand it, my English is not very good
thanks
modified 12-Sep-18 21:01pm.
|
|
|
|
|
No, you can't just use HWND as a process handle. For that you'll need to use ShellExecuteEx or get the handle with a call to GetWindowThreadProcessId/OpenProcess.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
|
Gregor S. wrote:
You are my hero of the month
Stop brown-nosing
BTW: you'll have to change FindWindow to EnumWindows. That's because your app may be started twice, and it may launch two (or more?) apps with ShellExecute. FindWindow will find first HWND with given class/caption - this criteria is too weak if you can have more than one app launched with ShellExecute.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Gregor S. wrote:
you might take a look at my comment "Just found strange behavior"
It looks like synchronization problem. Your 2nd FindWindow call finds the main window launched by 1st ShellExecute call, then sends the message. Message is processed OK and item is selected.
It seems that launched app needs some time before it can accept messages - WaitInputIdle ensures that. Use ShellExecuteEx to avoid problems with mutliple target windows - you'll get the process handle. You'll also have to abandon FindWindow - if two apps were launched, the find criteria are too weak. EnumWindows and GetWindowThreadProcessId are the way to go.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I need to handle a 2D Array whose first subscript is known to me only at runtime.The Array is an array of strings.The second subscript is the max size of a string.But I want to use only character arrays but not CString to represent a string.
Hence,if I declare an array,like
#define MAX_STRING_SZ 10
char MyArray[][MAX_STRING_SZ+1];
...
and I want to use the above array in a function F1.
F1 will return such arrays , n numbers,to function F2,where The arrays's members are shown in a list view.
But,the array declaration is not allowed in Microsoft Visual C++ to have empty braces[] as well as with any variable,whose value I would supply as and when I get.
I am in urgent need of this.
Thanking you ,The Experts,in advance!!!
Best Regards,
GVBhaskar
srigvb@yahoo.com
srigvb@rediffmail.com
gvbhaskar@hotmail.com
G.V.Bhaskar
|
|
|
|
|
Can't you use CStringArray, CStringList or std::vector<std::string> ?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
First of all, I'd recommend forgetting about 2D arrays and going to something more high-level like, for instance, a std::vector of std::string s. Anyway, if you can't afford it, the syntax you must follow is like this:
void F2(char array[][MAX_STRING_SZ+1],int len); Here len is needed to inform about the first dimension of the 2D array. To define a variable capable of holding 2D arrays of unspecified (i.e. determined at run-time) first dimension, the syntax is:
char (* MyArray)[MAX_STRING_SZ+1]; which is also the return type of your F1 function. Remember, the first dimension must be passed along somehow. And please allow me to recommend you again that you use STL containers to make your life easier.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Why RichEdit20A scroll the contents of the CRichEditCtrl in view ?
For example, I wrote handler for ON_WM_VSCROLL():
[ccode]
void CRichSyntaxView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
CRichEditView::OnVScroll(nSBCode, nPos, pScrollBar); //call std handler
CRichEditCtrl& r = GetRichEditCtrl();
CHARFORMAT2A cf;
CHARRANGE ccr;
memset(&cf,0,sizeof(cf)); // clear
r.SetRedraw(false); // don'n redraw
r.HideSelection(true, true); //don't show the selection
r.GetSel(ccr); //save old selection
r.SetSel(iMin, iMax); //set new selection
...
r.SetSel(ccr); //restore selection
r.HideSelection(false, true); //show the selection
r.SetRedraw(true); //redraw=on
Invalidate(false); // refresh view
}
[/ccode]
In Richedit 1.0 all ok. Why?
=== MSDN98 ===:
SetSel(..)
The caret is placed at the end of the selection indicated by the greater
of the start (cpMin or nStartChar) and end (cpMax or nEndChar) indices.
This function does not scroll the contents of the CRichEditCtrl
so that the caret is visible.
RichEdit20A - glucked..
Please help me!
thank you..
|
|
|
|
|
I´m creating a new app that needs to export some data to excel. It´ll be a WEB app, the user will click on a link that will activate an ISAPI Extension written in VC++ that will send the data as an xls file. My question is: do I need a copy of Excel installed on my server to export the data or there is some other way ?
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
|
|
|
|
|
If you export your data as a CSV (which excel knows how to read), you will not need excel.
(2b || !2b)
|
|
|
|
|
Depends that you need, If you want, you can make csv files, with coma separated or you can make excel files, using ole automation, for this you need the excel installed on your sever...
Also if you want, you can write excel file knowing the Excel format, for this you can see it here
Best Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Carlos Antollini wrote:
for this you can see it here
Where !?
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
|
|
|
|
|
I'm sorry Mauricio:
here
Best Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Gracias !
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
|
|
|
|
|
De nada;)
Carlos Antollini.
Sonork ID 100.10529 cantollini
"There is an old saying that if a million monkeys typed on a million keyboards for a million years, eventually all the works of Shakespeare would be produced. Now, thanks to Usenet, we know this is not true."
|
|
|
|