- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why is it that when I execute a dll from vb, a console window flashes up on my screen? How can I make it not do that?
Link Copied
10 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Normally, it doesn't. In fact, a DLL has no console of its own. Perhaps something in your DLL code is creating a console?
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve,
I wonder if there is something in my project settings that will cause a console window to open? BTW I too am in NH ... Dover.
Mike
I wonder if there is something in my project settings that will cause a console window to open? BTW I too am in NH ... Dover.
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not in a DLL project... Can you figure out what line of code is executing in your DLL when this window appears? Are you sure it's a console window?
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm guessing that it might be a SYSTEMQQ command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That would do it! Look into using CreateProcess or perhaps ShellExecute as an alternative.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
Okay ... I've tried to figure out the CREATEPROCESS and the SHELLEXECUTE, and I can't seem to find any information on this. Do you have any suggestions?
Mike
Okay ... I've tried to figure out the CREATEPROCESS and the SHELLEXECUTE, and I can't seem to find any information on this. Do you have any suggestions?
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can always go to http://msdn.microsoft.com for documentation on system routines. Here is an example with CreateProcess:
program example use dfwbase use kernel32 implicit none type (T_STARTUPINFO) si type (T_PROCESS_INFORMATION) pi call ZeroMemory (LOC(si), SIZEOF(si)) call ZeroMemory (LOC(pi), SIZEOF(pi)) si%cb = SIZEOF (si) si%dwFlags = STARTF_USESTDHANDLES if (CreateProcess(NULL,'notepad junk.txt'c,NULL,NULL,FALSE, & DETACHED_PROCESS,NULL,NULL,si,pi) /= 0) then print *, 'Process created', pi%dwProcessId else print *, 'CreateProcess error', GetLastError() end if end program exampleJames
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Okay ... I copied the code from the example and I get all sorts of compile errors about the actual arguments not matching dummy argument type. Here's my code ... let me know what you think.
program MIKE
use kernel32
implicit none
INTEGER INSTANCE,X
type (T_STARTUPINFO) si
type (T_PROCESS_INFORMATION) pi
call ZeroMemory (LOC(si), SIZEOF(si))
call ZeroMemory (LOC(pi), SIZEOF(pi))
si%cb = SIZEOF (si)
si%dwFlags = STARTF_USESTDHANDLES
INSTANCE=CreateProcessNULL,'C:WINNTNOTEPAD',NULL,NULL,&
FALSE,DETACHED_PROCESS,NULL,NULL,si,pi)
end program MIKE
program MIKE
use kernel32
implicit none
INTEGER INSTANCE,X
type (T_STARTUPINFO) si
type (T_PROCESS_INFORMATION) pi
call ZeroMemory (LOC(si), SIZEOF(si))
call ZeroMemory (LOC(pi), SIZEOF(pi))
si%cb = SIZEOF (si)
si%dwFlags = STARTF_USESTDHANDLES
INSTANCE=CreateProcessNULL,'C:WINNTNOTEPAD',NULL,NULL,&
FALSE,DETACHED_PROCESS,NULL,NULL,si,pi)
end program MIKE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are missing a "(" in the CreateProcess call. Also you shouldn't need to put the path in for Notepad, and that needs to be a C string as in the example.
James
James
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page