|
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," , ");
}
}}
}
|
|
|
|
|
Hello Barbara,
I don^t know if it is intentional but the code you send seems kind of erroneous.
first your array c is of type char, and yet you wanted to perform the line:
c[i][j] = atof(token);
char is one byte long, return value of atof is 8 bytes long...
also atoi returns integer, sizeof int on my station is still 4 bytes.
So you would lose precision because of truncation (eg all strings representing a value bigger then 256(in the atoi case) would not be converted correctly), in the atof case simply all strings would be incorrect.
Second you presume the line will never contain more then 2 tokens (which is your right offcourse), but if I were you(which I`m not) I`ld make sure that j never gets bigger then 2.
Third, you might want to check if your txt file is ANSI format or Unicode, make sure it is ANSI if you want to work with normal char strings, othewise use wide character strings.
Fourth, I'm not sure about that one but the getline function doesn^t it take as second parameter the size of the buffer?....
Anyway, I hope these remarks may help you.
Greetz,
Davy
|
|
|
|
|
GDavy wrote:
first your array c is of type char, and yet you wanted to perform the line:
c[i][j] = atof(token);
Or maybe that she was actually using atoi() !! It's probably going to be all of the things you mentioned.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi,I am asking for help!
I built a project by using VC++,and wanted to debug it.
But after I started to debug,it displayed something like assembley code,and said cannot set a breakpoint at the cursor location.
And the error msgs about debug are :
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\Tcl\bin\tcl83.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\opengl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\glu32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ddraw.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\dciman32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\lpk.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\usp10.dll', no matching symbolic information found.
The program 'D:\Thesis\OpenSees\Win32\bin\openSees.exe' has exited with code 0 (0x0).
I don't understand what's going on.
Anybody knows that?
|
|
|
|
|
1. Try to clean the project and rebuild all
2. May be u have used such controls in your application which don't let u start your application
|
|
|
|
|
You probably built a Release build without debugging information. Select 'Win32 Debug' from the Build toolbar, or select 'projectname - Win32 Debug' in the Build > Set Active Configuration dialog. Then try again. (Instructions for VC 6.0).
If you want to debug the release build, it can be helpful to create debugging information. You can do this by selecting 'Program Database' under Debug Info on the C/C++ tab of the Project > Settings dialog, and ticking 'Generate debug info' on the Link tab. Ticking this box disables a release-mode optimization, which you can turn back on by adding /OPT:REF to the Link Options box.
The 'error messages' are simply the debugger telling you which DLLs were loaded. 'No matching symbolic information' indicates that the debugger couldn't find debugging symbols for these DLLs: this is not a problem, unless you find yourself stopped in the middle of the DLL. If you want to, you can download debugging symbols from Windows Hardware and Driver Central[^]. However, these don't include debugging symbols for security patches; these used to be contained in the patch package but don't appear to be any more.
If you need to, you can get Visual Studio .NET to download symbol files from a Microsoft server on demand. See HOW TO: Use a Symbol Server with the Visual Studio .NET Debugger[^] for more details on this.
|
|
|
|
|
Hello !
I am trying to develop a systray application using MFC.
NOTE: I am beginner.
I performed that application sucessfully, therefore, when I run the program I can see the icon on the systray, but, I also see the dialog window open as well.
When the program runs the following lines:
CTrayIco dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.Modal();
the dialog windows appears, and I don't want to show it. I tried to delete these lines, but, the program didn`t run fine.
I would like to put the icon on the systray as soon as I run the program without any dialog window.
How can I do that ?
Thanks in advance.
|
|
|
|