|
Hi virtual friends,
my requirement is to display all the exposed properties
and its values of a activex control.
currently am using a function GetIDsofNames shown below
pDispatch->GetIDsOfNames(IID_NULL, names, 1, LOCALE_USER_DEFAULT, &dispid))
where pDispatch is the Dispatch pointer of the activeX control, to access
the properties.The problem am facing currently is that whenever i access a
runtime property it pop-ups a message box telling that this property is
runtime property.
Now how do i avoid this messagebox.Is there anyway that i could know if its
a runtime property and hence bypass GetIDsofNames?
Regards
Pradeep
|
|
|
|
|
I have a question about DLLs and esp MFC extension DLLs. If I make the MFC extension DLL and put in it many exported classes and also have other defines etc, are these defines then ONLY used internally to the DLL? How would you make some "defines" exported or would you not do this? THose classes not exported in the DLL are then assumed to be used only WITHIN the DLL, is that right?
Thanks.
|
|
|
|
|
I forgot to add this. If I several classes in the DLL to export, I need to include the header file for all the classes?
|
|
|
|
|
First of all, I am not sure what you mean by "defines". Is it #define, or is it any variable, method or class ?
In short, I recommend to just use the __declspec(dllexport) / __declspec(dllimport) modifiers.
#ifdef MFC_DLL
#define EXPORTEDSTUFF __declspec(dllexport)
#else
#define EXPORTEDSTUFF __declspec(dllimport)
#endif
You can use EXPORTEDSTUFF in front of a variable, C method, C++ method, class.
Now you can compile your MFC dll with the MFC_DLL symbol.
In the client application, you just include the appropriate headers (because of course the compiler needs to solve the type declarations), without the MFC_DLL symbol.
That's all about it.
How low can you go ? (MS rant)
|
|
|
|
|
Can anyone see why this block, which is reading from the serial port, allows szBuffer to filled with more than 10 bytes? I just dont see how its being allocated more. When I run in the program it will allow an unlimited number of characters to be placed into szBuffer (so long as the '>' isnt sent to it (ASCII 62))
Any help would be appreciated
-Mel
ps. I left the last while statement there to lend clarity to what fContinue is doing but the code above is just error handling of error events and I was tryign to keep the post small so I left it out
-Mel
<br />
if (eEvent & CSerial::EEventRecv)<br />
{<br />
DWORD dwBytesRead = 0;<br />
char szBuffer[10];<br />
do<br />
{<br />
lLastError = serial.Read(szBuffer,sizeof(szBuffer)- 1,&dwBytesRead);<br />
if(lLastError != ERROR_SUCCESS)<br />
return ShowError(serial.GetLastError(), _T("Unable to read from COM-Port"));<br />
<br />
if(dwBytesRead >0)<br />
{<br />
if (szBuffer[dwBytesRead-1] == 62)<br />
fContinue = false;<br />
}<br />
}while (dwBytesRead == sizeof(szBuffer)-1);<br />
}
}while (fContinue);<br />
<br />
---------------------------------------------
Be good! But if you can't be good, at least be good at it and try not to get any on ya!
-mjf
|
|
|
|
|
How come there are two while loops?
Kuphryn
|
|
|
|
|
I left the last while statement there to lend clarity to what fContinue is doing but the code above is just error handling of error events and I was tryign to keep the post small...
-Mel
---------------------------------------------
Be good! But if you can't be good, at least be good at it and try not to get any on ya!
-mjf
|
|
|
|
|
As an experiment, use "10" instead of sizeof().
Kuphryn
|
|
|
|
|
out put was the same... I typed "the quick red fox jumped over the lazy brown dog" and it all went into szBuffer. Maybe its not as obvious as I thought, I just figured I was getting a bit fuzzy in the head as I've been in at it since 9am with just a two hour dinner break.
---------------------------------------------
Be good! But if you can't be good, at least be good at it and try not to get any on ya!
-mjf
|
|
|
|
|
Something is definitely looping and reading the data. Otherwise, maybe the COM part of the implementation dynamically expands szBuffer to accommodate the data.
Kuphryn
|
|
|
|
|
This code makes me shiver. Should you be checking each character of szBuffer for >? Does Read ever set dwBytesRead to the required buffer size that's available in the queue? Try adding ASSERT() after read to be sure.
do
{
if (eEvent & CSerial::EEventRecv)
{
DWORD dwBytesRead = 0;
char szBuffer[10];
do
{
lLastError = serial.Read(szBuffer, sizeof(szBuffer)-1, &dwBytesRead);
ASSERT(dwBytesRead < 10);
if(lLastError != ERROR_SUCCESS)
return ShowError(serial.GetLastError(), _T("Unable to read from COM-Port"));
if(dwBytesRead > 0)
{
if (szBuffer[dwBytesRead-1] == '>')
fContinue = false;
}
} while (dwBytesRead == sizeof(szBuffer)-1);
}
} while (fContinue);
Todd Smith
|
|
|
|
|
nope.. the ASSERT didn't catch it either - ggrrrr! AT this stage I'm just using 10 as an arbitrary value that doesn't take a long time for me type out from the sending machine. In practice, I will have no idea of the sizeof the incoming data persay. Actually, I will be testing the first few characters and then know the size (there are several different formatted messages coming in of different but known sizes and I want to make sure it breaks not only on the '>' but on a full szBuffer (for any case where the '>' didn't get sent)
---------------------------------------------
Be good! But if you can't be good, at least be good at it and try not to get any on ya!
-mjf
|
|
|
|
|
Oh. How are you determining that szBuffer has more than 10 bytes in it? Try this
change
DWORD dwReadBytes;
char szBuffer[10];
do
{
Read();
}
to
do
{
DWORD dwReadBytes;
char szBuffer[10] = {0};
Read();
}
Todd Smith
|
|
|
|
|
well.. your question regarding how i'm checking szBuffer got me thinking and I've determined that dwBytesRead is always 1 so I'm gonna have to take a good look at that. As to how I am actually checking- good question- had a line in there that was concat-ing szBuffer[dwBytesRead-1]to another string that was being displayed else where in code. You can see the problem with that knowing dwBytesRead is always one - so it wasn't szBuffer that was gettign the extra memory after all. Writing the code at you have it here required the do/while condition to be redone as well... thinking it might be a good idea to approach this with a more alert mind so I'm packing in the VC for the night - but thanks for the input and if you happen to think of anything else send it over - it cant hurt.
Thanks
-Mel
---------------------------------------------
Be good! But if you can't be good, at least be good at it and try not to get any on ya!
-mjf
|
|
|
|
|
i want to run a perticuler registry key how to run it any body could tell the sample code
i will be very thank full to u?
r00d0034@yahoo.com
|
|
|
|
|
what do you mean ? you don't 'run' a registry key.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
thanks for replay.
infect i want to uninstall a software that appear in add/remove program.
then i can go to registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
and look for uninstallString key.
The Sub keys of the key i mention contain a REG_SZ:Uninstallstring. i just need to run that.
but in a program how to find it and run it?
plzz help
if u could write sample code.
plzzzzzz
r00d0034@yahoo.com
|
|
|
|
|
Ah - that's different. You want to read a string from the registry. There are at least two classes with sample code to do this on CP.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
what do u mean by CP?
and what those classes are?
r00d0034@yahoo.com
|
|
|
|
|
Um... Code Project. You're not really cut out for this, are you ?
At least one of them is called CRegistry.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
These keys are the properties of the installed applications. (Content of the Add/Remove programs Windows panel).
It is highly recommended not to do anything with them. You can corrupt things a bit.
Applications often use InstallShield to install, and they create such keys to help the Uninstaller do his job when the user decides to remove the program. In the case of InstallShield, the Uninstaller is a separate program (IsUninst.exe) installed along with the program, and it uses the content of these keys as cmdline parameters.
In short, leave this alone!;)
How low can you go ? (MS rant)
|
|
|
|
|
There are solution solution to read in a registry key.
Win32 API:
RegOpenKey()
RegOpenKeyEx()
MFC:
GetProfileString()
As for uninstallation, you can use an uninstaller such as InstallShield or design your own uninstaller.
Kuphryn
|
|
|
|
|
what do you mean by this?
As for uninstallation, you can use an uninstaller such as InstallShield or design your own uninstaller.
infect i want to uninstall programatically any software with out any user interaction?
r00d0034@yahoo.com
|
|
|
|
|
Okay.
You cannot programmably uninstall an application if it was installed using some other vendor's installer such as InstallShield. One reason is you would have to read and understand InstallShield's logfile.
Another solution is if the registry key list some uninstall executable line "unwise.exe," then you can execute that file.
HINSTANCE ShellExecute(HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFile, LPCTSTR lpParameters, LPCTSTR lpDirectory, INT nShowCmd)
UINT WinExec(LPCSTR lpCmdLine, UINT uCmdShow)
Kuphryn
|
|
|
|
|
Or CreateProcess()
Todd Smith
|
|
|
|