|
You're either wanting to know the id of the control (GetDlgCtrlID() ) or the window class name (GetClassName() ).
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi David,
i m not wanting to know the id of control. i want to extract the name of control. for e.g.: in vb name of editbox is Name. if u want to display its text u can do it using Msgbox Name.Text . this name, i want to extract. because identifying controls of another running application is easier with name than with objectIndex and Class name.
Thanks in advance,
Naveen S G
|
|
|
|
|
naveensg wrote:
i want to extract the name of control.
This is a VB thing. Controls in VC do not have names, they have ids instead. Your MsgBox Name.text statement would equate to the following in VC:
GetDlgItemText(...); or GetWindowText(...);
MessageBox(...);
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
i accept that controls in VC do not have names. but i want to extract the control name of running VB Application from my VC Program.
|
|
|
|
|
Any standard ActiveX Container (i hope VB is) should support for DISPLAYNAME ambient property that from inside of the control could be accessed through
GetAmbientProperty(DISPID_AMBIENT_DISPLAYNAME, var);
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
do u have any sample code related to that. if u have plz mail me.
i have read in some article that by getting container of the form and by doing queryinterface, v can get the name of controls.
|
|
|
|
|
It's straightfoward:
If you are using MFC and your control is COleControl derived somewhere inside of your controls code just use the following:
...
CString strControlName;<br />
GetAmbientProperty(DISPID_AMBIENT_DISPLAYNAME, VT_BSTR, &strControlName); ...
After that strControlName will be filled with the name assigned to your control by the container.
For implementation detailes see GetAmbientProperty implementation in MFC.
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
just take for example there are no activex/ole controls in VB form. it contains only standard controls like editbox, combobox.
just by getting window handle, is it possible to get the clientsite/IDisapatch/IUnknown. because if i get the clientsite, it is possible to get the control names.
Given a pointer to IOleClientSite, it is possible to enumerate through all of the other controls on a form by making use of the following interfaces:
IOleClientSite,IOleContainer,IEnumUnknown,IUnknown,IOleObject,IOleClientSite,
IOleControlSite.
but my question is:
i have only window caption and its class. by using those information is it possible to get the clientsite of the VB Form.
Thanks in advance,
Naveen S G
|
|
|
|
|
Common answer is NO.
However, you may try to look into the following possibilities:
1. If your VB App is automation server -- maybe there is method that returns you what you need -- is it registering itself in Running Objectc Table or maybe it's singleton -- you can get IDispatch of it;
2. Maybe VB Form is dynamic container and allow new control insertion -- so you may write your new control that has functionality you need;
3. If form has at least one ActiveX Control -- you can look into it's CLSID and write your control that will register under the same CLSID as original one and will be just an aggregator for original control -- so VB Form will create your control and your control will be delegating all OLE calls to original control;
4. Overload CoCreateInstance -- using different techniques of injecting your code -- try overloading CoCreateInstance/CoGetClassObject -- it is possible that control name could be extracted through VB Extender control -- passed to CoCreateInstance as pOuterUnknown;
5. If your VB App is Active Accessibility Compliant: Check AccessibleObjectFromWindow available in OLEACC.dll as well as read that article and search MSDN:
http://msdn.microsoft.com/msdnmag/issues/0400/aaccess/default.aspx
In any case it's R&D and may require alot of efforts to implement or fail -- unless VB code is accessible for modifications...
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
i would like to know how to get the handle of context menu of some other running MFC application or how to work on context menu of some other MFC application. i want to check whether some particular menu item is enabled or not.
if anybody knows, plz mail me.
Naveen
|
|
|
|
|
Your going to have to setup a hook of some type. Take alook at the article about injecting code into another process. You can find a link on the codeproject homepage under most popular articles on the right hand side.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Hi Allen,
thanks for replying.
i want to check whether some particular menu item exists and is enabled in the context menu of some running MFC Application from my VC/VB program.
if u have any sample code or articles related to that, plz mail me ASAP.
Thanks in advance,
Naveen S G
|
|
|
|
|
Hi! I have a button in my app that I want to have the ability to have urls (Hotlinks from in webbrowsers) dropped on it. How would I go about setting that up, and knowing that it was a hotlink that was being dropped etc.
Cheers
Dom
|
|
|
|
|
Read the Platform SDK documentation on OLE drag-and-drop. See (at minimum) the IDropTarget interface and the RegisterDragDrop function.
MFC offers a helper class: COleDropTarget and its Register method.
|
|
|
|
|
Thanks for that A bit of a newbie question here but is it possible to overide a function for an instance of a class rather than for the entire class?
Cheers
Dom
|
|
|
|
|
Improperly interfacing between the hardware and software is there will cause pc damage. How to avoid this problem occurs? Is there any tutorial will helping in interfacing.....
|
|
|
|
|
It depends entirely upon what you are interfacing too? Obviously plugging your serial port into the mains power supply is going to cause a few problems... best advice is: don't do it unless you know what it is you are doing.
|
|
|
|
|
If there any website which can provided interfacing example or basic tutorial.How i have to do if i don't have knowledge about printer port interfacing.....
|
|
|
|
|
|
Thank you for yr suggestion Jonny.........
|
|
|
|
|
How to obtain the original length and height of a window (as they were defined in the the resource file) or is there a function which restores the window to it's original size?
|
|
|
|
|
you can enumerate resources of the executable
containing that dialog box if the window is a dialog
which is created from resources. take a look at
this API documentation : EnumResourceNames()
but to identify which resource corresponds to that
window you need to compare window names, or if the
name is modified, you need to compare its contents.
but about a simple API that does the job, at least
I haven't heard of.
|
|
|
|
|
CRect rc;
GetWindowRect(rc);
rc.Width();
rc.Height();
|
|
|
|
|
Hello.
I was using Microsoft Slider Control ActiveX ( the one with comes with mscomctl.ocx ) without problems but now, I have tested in Windows Server 2003 and it doesn't works.
I have tried to create a simple HTML page that only displays the slider, and in Windows Server 2003 the slider is not displayed-
Anyone can help me ??
Thanks
|
|
|
|
|
i am trying to read a text file "japan.txt" which contains two coloumn of data
44,245
34,456
...
however when i try to convert each number from char to double the atof function
somehow doesn't work (c[i][j] = atoi(token);) (when i check what is c[i][j] it gives me 0)
any help greatly appreciated
thanks
barb
void tokenizer(){
char c[22][2]
char b[20];
char* token;
ifstream file;
file.open("japan.txt");
while (!file.eof()){
for (int i = 0; i< 21; i++) {
file.getline(b,' '); // read each line from file
int j = 0;
token = strtok(b," , ");
while (token != NULL){
//printf("dec1: %s\n", token);
c[i][j] = atoi(token); // convert from char to double
j++;
token= strtok(NULL," , ");
}
}}
}
|
|
|
|