The code compiles in Dev-C++, Visual C++ and LCC-WIN32. I don't know the library system that Borland uses but try getting rid of all the "#pragma comment(lib, ...)" lines and using import32.lib instead.
The code compiles in Dev-C++, Visual C++ and LCC-WIN32. I don't know the library system that Borland uses but try getting rid of all the "#pragma comment(lib, ...)" lines and using import32.lib instead.
Ya, my bad, I was just being dumb. Sry. How do I get a .CPP file to compile with a .c file? It cann't find the function, and if I put a prototype up, it says Undeclared external sonthing morother. So i'm trying to build a DLL, but since i've never built one, its going slowly!
i get an error here:
DWCode:extern "C" __declspec(dllexport)BOOL xAddSelfAsStartupShortcut(LPCTSTR szLinkTitle, LPCTSTR szDescription, LPCTSTR szArguments, int IconResourceID);
Here is the Dev-C++ project. I don't know the details of the Borland compiler but I would check if it supports __declspec(dllexport). You should be able to just add the .c file to your project. Good pickup on the extern "C", which was missing.
I gave up on the DLL. I just got it to work with the extern "c" part. I can't believe i forgot it. I'll post the BCB project incase anyone needs it.
I have a question though, how do you remove it?
DW
Code:BOOL xDeleteSelfAsStartupShortcut(LPCTSTR szLinkTitle) { TCHAR szLinkName[MAX_PATH + MAX_PATH + 10]; if (FAILED(xGetFolderPath(szLinkName, CSIDL_STARTUP))) { return FALSE; } lstrcat(szLinkName, TEXT("\\")); lstrcat(szLinkName, szLinkTitle); lstrcat(szLinkName, TEXT(".lnk")); return DeleteFile(szLinkName); }
"How is as such: add it(the .c file) to your project through Project-> Add to project, then add the function prototype, and Voila, it should work. Fix the linker stuff, and your good to go."
- "the .c file" hmm. Can I just create this manually to "My projects" -folder? 'Cause I really didn't understand the above, except for the linker -part.
Or can you attach "the .c file" to this forum so I can just download it and add it to "My projects" -folder?
Thanks for any assistance.
Huh, didn't even notice there was a second page.
Well, so. I'll try to work something out but I still prob. need an attached project with the autorun and then I'll just edit it.
"need an attached project with the autorun and then I'll just edit it."
Yep, tried everything. So can somebody attach a project here which is a "complete example" that includes the whole project with an application of your own, and then I'll just change the application code and phuff. :>
Getting an error from this line in Dev-C++:
hres = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (void **) &psl);
Reason:
71 C:\Program Files\Dev-C++\My Projects\AutoRun.c
could not convert `&CLSID_ShellLink' to `const CLSID&'
So what to do?
Alright, now I've done it with Borland. But I only have the autostartup, so how can i add my program there?
And i want to take that "add"/"exit" off.
I just want one program, and when started, it will first put a shortcut to StartUp, and then it will just open my own program.
I mean i want this shortcut-thing to be so-called function, and the main program is my program.
So how can I do this with borland?
5 concutive post! OMG! I think you beat my record! lol
I have a deal for you. What compiler are you using? Dev-C++ or Borland C++ Builder? If you send me your project, add it for you. PM me..
DW
Uh, huh, buuh. This forum is way too complicated for built/help instructions.
Come to IRC(internet relay chat) on Quakenet, channel: #bleehbleeh
If you do not have irc, we could also go to somekind of a chat on web.
How do I get this too work in dev-c++? I really don't have much experiance with it. It works fine in BCB.....
I add the .c file, add '-lole32 -luuid -lshell32' to the linker parameters, then extern "C" it.
i get a linker error as such:Fatal E:\MyDocs\Chris\AutoRun Example\Fatal
'all-before' does not exist - don't know how to make it
cheers
DW
PS: that removal code works fine too! thx!
Not to be harsh, but if you don't understand how to remove the yes/no question from the example program then this is way too advanced for you and you should go back into studying if-statements.Originally Posted by nouneim
Heh.Originally Posted by nouneim
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
"Not to be harsh, but if you don't understand how to remove the yes/no question from the example program then this is way too advanced for you and you should go back into studying if-statements."
To be exact, I compiled the program with BCB, which I had never used before, so I couldn't even get in touch with the file that had the code.
And maybe so, maybe I am a newbie, yet the best way to learn is to get a code and start editing it and look the commands from a c++ -book, which is a bit more difficult for me 'cause the book I have is finnish-translated and all the examples are in finnish. Also I have never before had in touch with system-settings nor anything like it.
But what am I defending myself for? So then I am a newbie, ohmigosh.