|
Thanks for your reply. I have tried to use that statement u mention. It can't work, apparently SetMessageText is not a member of AfxGetMainWnd().
|
|
|
|
|
I have a VB dll, and a VC client. In this snippet of code from the client :
BOOL _CRemoteCall::MoveProgressBarX(long hPBHWND, long iMin, long iMax)
{
BOOL result;
static BYTE parms[] =
VTS_I4 VTS_I4 VTS_I4;
InvokeHelper(0x60030002, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
hPBHWND, iMin, iMax);
return result;
}
how do I get that number 0x600.....? I think what the call does is it calls a particular function from the VB dll, but I just cant figure how out to get that number. Also I hope this number isnt machine specific (just cant be because its hardcoded...)
Thanks,
ns
|
|
|
|
|
It's the DispID of the VB Object, it won't chang from machine to machine..
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Okay. thanks. I dont know how to get this DispID. Is there a procedure outlined somewhere that you know of? Is is somethin that can be answered in a post without too much trouble ?
Thanks,
ns
|
|
|
|
|
That depends... The only way I know is using the #import statement to import the dll. Then, in the .tlb-file generated by VC, you can see some const's called IID_SomeName. That's the ones you want
Hope it helps...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
You can use OLE View that comes with VC++ 6.0. You open a typelib, select the appropriate interface (probably an IDispatch-derived one).
Browse through the methods and you'll notice ids.
If a train station is where the train stops, what's a workstation...?
|
|
|
|
|
Wonderful! Thats exactly where I found it (for the sample) after you directed me. APpreciate it!
Then I looked for a tlb in my VB prj folder and there wasnt one! So I have to locate a tlb file for my prj. Wonder if you have to tell VB to make it...
Thanks,
ns
|
|
|
|
|
DLLs usually incorporate the TLB as a resource. OLe View can read those as well. Just load the dll (or exe) instead.
If a train station is where the train stops, what's a workstation...?
|
|
|
|
|
I need the complated path to load a library, this library is in the same place that the executable, I see the class CWinApp, but this class doesn´t give me the complated path. Also i have changed the path with m_pszProfilePath but it doesn´t work.
thank in advances.
|
|
|
|
|
::GetModuleFileName()
...make it about Visual C++, and don't ever mention Visual Basic. Nick Hodapp (MSFT) in Semicolon[^]
|
|
|
|
|
Use GetModuleFileName()
If a train station is where the train stops, what's a workstation...?
|
|
|
|
|
hi all,
can u tell me how to convert a BSTR to char(i want to display the bstr value)
|
|
|
|
|
Use the OLE2T() macro.
Look! They have the Internet on computers now! (Homer J. Simpson)
|
|
|
|
|
Or assign it to a CString, or use _bstr_t
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
e.g BSTR bstrValue
_bstr_t bstrTemp(bstrValue);
CString sValue = (LPCTSTR)bstrTemp;
|
|
|
|
|
Use MAKELONG(hAtom, 0) where hAtom is your ATOM value you got from RegisterClassEx.
Look! They have the Internet on computers now! (Homer J. Simpson)
|
|
|
|
|
no problem, always happy to help
If a train station is where the train stops, what's a workstation...?
|
|
|
|
|
Just cast it to a LPCTSTR like so: (LPCTSTR)MAKELONG(...)
If a train station is where the train stops, what's a workstation...?
|
|
|
|
|
adrian cooper wrote:
while(beerInFridge()) {
You should make this a member of CKitchen and get a instance, instead of a global function. You might get the beerlevel of some foreign fridge. (besides of a possible beerleak)
...make it about Visual C++, and don't ever mention Visual Basic. Nick Hodapp (MSFT) in Semicolon[^]
|
|
|
|
|
When I use VB.NET to call a 'C' dll. It displayed error as follow
ERROR
=====
"Object reference not set to an instance of an object."
'C' FILE (Not C++, so hasn't used _stdcall)
===========================================
BOOLEAN WINAPI PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize)
'DEF' FILE
==========
EXPORT
PacketGetAdapterNames
In VB.NET
=========
Private Declare Function PacketGetAdapterNames Lib "packet.dll" (<marshalas(unmanagedtype.lpwstr)> ByVal lpBuf As String, <marshalas(unmanagedtype.u8)> ByVal BufferSize As Long) As Boolean
.
.
lSuccess = PacketGetAdapterNames(Name, Size)
.
It display error.
More investigation
==================
I try to use "LoadLibrary" and "GetProcAddress" to test its existence. It hasn't reported error.
I also write another routine in C++ with same argument, no error.
So, any ideas on how to call this 'C' routine in VB ?
Danny
|
|
|
|
|
Hi,
I have a long string which is obtained from the other class.
Now i want add this string into my ListBox in main dialog.
I can get the string but it cannot be added as i expected.
The problem is how to splite the string with separate point
"\\"?
My string looks like :
"this is one \\ this is two \\ this is three \\ ..........."
The expected format when added the string into listbox should be:
This is one
this is two
this is three
..........
Thanks in advance!
chen
|
|
|
|
|
Split up the string using strtok() or the Tokenize() CString member if you're using MFC.
Look! They have the Internet on computers now! (Homer J. Simpson)
|
|
|
|
|
Here's an example: I get the CLSID of the program using CLSIDFromString, how do I get the version number?
Jonathan de Halleux, Belgium.
|
|
|
|
|
First of all, interfaces don't have version numbers, they are supposed to be immutable. You can get the version of the executable that implements the interface by using the GetFileVersionInfo and related APIs.
Look! They have the Internet on computers now! (Homer J. Simpson)
|
|
|
|
|
Thks
Jonathan de Halleux, Belgium.
|
|
|
|