|
Indeed I did.
Thanks for the pointer.
|
|
|
|
|
I finally finished my project. So I thought I would test it on a neighbours computers, just in case. And it doesn't work :'(
I have narrowed the problem down to the importing and initialising of an activeX dll. But I can't find out why it works on my machine and not on another (with identical configuration).
Here is the code:
_clsXLPtr xls;
try {
CoInitialize(NULL);
xls.CreateInstance(__uuidof(clsXL));
xls->Visible(&vis);
The CreateInstance call is failing, but why?
|
|
|
|
|
If the DLL registered on your neighbors computer?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
waldermort wrote: xls.CreateInstance(__uuidof(clsXL)); // failing
Had you bothered to check the return value of CreateInstance() , you would have likely seen it was -2147221164, which indicates a class has not yet been registered. You'll need to use regsvr32 for this.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks for the quick replies. Could you possibly explain why this works on my machine and not on others?
|
|
|
|
|
waldermort wrote: Could you possibly explain why this works on my machine and not on others?
Because of lack of registration.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Now I'm getting error's when trying to register. "ExCom.dll was loaded, but the DllInstall entry point was not found.".
|
|
|
|
|
Which indicates DllInstall() does not exist or has not been (properly) exported.
See here for more.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
WinExec("regsvr32 ExCom.dll",SW_SHOW);
"DllRegisterServer in ExCom.dll Succeeded".
Yet CreateInstance() is still failing on the other machine.
|
|
|
|
|
waldermort wrote: Yet CreateInstance() is still failing on the other machine.
What is it returning?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
-2147221164.
#import "ExCom.dll" no_namespace
WinExec("regsvr32 /s ExCom.dll",SW_SHOW);
try {
CoInitialize(NULL);
long foo = xls.CreateInstance(__uuidof(clsXL));
char *val = new char [100];
ltoa(foo,val,10);
MessageBox(NULL,val,0,0);
delete val;
xls->Visible(&vis);
} catch(_com_error &e) {
data.error = e.Description();
MessageBox(NULL,_com_util::ConvertBSTRToString(data.error),0,0);
}
I'm sorry about this, and I thank you for your kind replies.
|
|
|
|
|
I don't know how or why but it's seems to be working now. I deleted every file including the dll's and libs apart from the source files and completely rebuilt everything. And hey presto it works. I have a feeling that choosing 'clean' and 'rebuild all' from the menu wasn't producing the same result.
Maybe it's time I got a newer version of my compiler.
Thanks for your help.
|
|
|
|
|
I suspect it was that call to WinExec() . You should be able to turn the error on and off by simply unregistering the DLL (from a command prompt not WinExec() ).
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
waldermort wrote:
WinExec("regsvr32 ExCom.dll",SW_SHOW);
Why are you doing this programmatically? Do it once from the command prompt.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
This would go into the installer.
I was sending the file to my neighbour so he can test it for me, therefore I wanted to make it as simple as possible for him.
|
|
|
|
|
But it is potentially a timing problem where your program is trying to use the DLL before it has been registered. By registering at a command prompt, or through an actual install-type program, you've eliminated this possibility.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hello All,
I have a program which uses a XML file for initialisation of the program. Now i have to make that XML file scrambled or decoded in order to give to the end user. (it was not required in the beginning of the project)
How can i encrypt a file(since i need to modify couple of other files not just an XML file) and decrpyt on the memory without creating a temporary decrypted file?
Actually i can encrypt the file but i don't know how to decrypt the file on the memory into a text-based XML file and then use it as i used to do.
can Memory File Mapping be used for this? (i just heard it but never used)
or is there any other simple way?
I am currently using TinyXML and standard C++ streams for data reading.
Thanks
|
|
|
|
|
beko wrote: How can i encrypt a file...
Have you considered the Crypto API? (CRAPI)? Have you checked for articles here on CP? Have you Googled for examples?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
i didn't look at the Crpyto API,however i have done encrpytion of a file before. That was not a problem, it was a license file and i was encrypting and writing to a file and reading as binary, checking the date etc. (i searched in google and codeproject about encryption before doing this)
now i am going to look at Crypto API, i have seen two articles on codeproject.
Thanks for the pointer.
|
|
|
|
|
i want to add a dll file in MFC dialog base application and use it,
i am using this dll by create instancs by CoCreateInstance(...) but i want to other shortcut method id there is any other shotcut method please answer me.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Be nice, there are other OS:es than Windows to code in...;P
|
|
|
|
|
Ok, then I know. Did anyone tell the guy there are such things as books? Or a quite good (IMO) search engine called Google?
|
|
|
|
|
If he wasn't coding in windows it wouldn't say "Software Engineer" it would say "Unemployed".
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
CoCreateInstance is used with COM technology, which is a particular type of DLL.
Bankey Khandelwal wrote: i want to add a dll file in MFC dialog base application and use it,
If you simply what that (and nothing to do with COM or ActiveX or else), you can simply add the header files to your project (implicitlinking) and lin to the library supplied with your dll. The second method (which is explicit linking) is to load your dll with LoadLibrary then retrieve functions pointers in it (you need to know the name of the exported functions) with GetProcAddress.
|
|
|
|
|
#ifdef _DEBUG
#import "\Test\ATL Dialog\Debug\NewATLAttach.dll" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#else
#import "\Test\ATL Dialog\Release\NewATLAttach.dll" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#endif
Create the object using CoCreateInstance and use the methods
Knock out "T" from CAN'T
You 'CAN' if you think you 'CAN'
|
|
|
|