|
From a command line, verify the function really got exported with the name you are expecting by using this:
DumpBin /Exports MyDll.Dll
You should see the Fun1 in the list. If not, the function never 'escaped' from your DLL.
|
|
|
|
|
Dump of file MyDll.dll
File Type: DLL
Section contains the following exports for MyDll.dll
0 characteristics
42B9E5A6 time date stamp Wed Jun 22 18:26:46 2005
0.00 version
1 ordinal base
1 number of functions
1 number of names
ordinal hint RVA name
1 0 0000100A _Fun1@16
Summary
7000 .data
1000 .idata
3000 .rdata
2000 .reloc
2A000 .text
|
|
|
|
|
It is almost like your DLL does not have the DllMain 'entry point' that windows needs to call to load it.
Did you start with a generic DLL or a generic MFC DLL project? If so, that is strange, if not, then you need to add a DllMain to your DLL project.
|
|
|
|
|
I cretae the project by Visuasal Stadio Vizard.
New=>MFC DLL=>... See the file
// MyDll.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "MyDll.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
/////////////////////////////////////////////////////////////////////////////
// CMyDllApp
BEGIN_MESSAGE_MAP(CMyDllApp, CWinApp)
//{{AFX_MSG_MAP(CMyDllApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyDllApp construction
CMyDllApp::CMyDllApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CMyDllApp object
CMyDllApp theApp;
extern "C" __declspec(dllexport) void CALLBACK Fun1(HWND,
HINSTANCE,
LPTSTR lpCmdLine,
int)
{
int i;
i = 1;
}
|
|
|
|
|
When I look at similar entries in the registry, I notice ALL the ones I saw have a comma in between the name of the DLL and the function name.
Instead of
rundll32 Mydll Fun1
why don't you try
rundll32 Mydll.dll,Fun1
|
|
|
|
|
Are you needing the temporary file simply so that the two applications can communicate?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
Hi all,
This may be an anal question, but...
I've inherited some code where the original programmer would go through the hassle, for example, of doing an OS check before opening every single registry key the program looks at, eg, if it's VER_PLATFORM_WIN32_NT, then a "SOFTWARE\[whatever]" string is built, and if it's running on Win9x, then the string is "software\[whatever]".
My own tests and experience tell me that opening any key for reading should NOT be case-sensitive. I'm tempted to modify the code and hardwire "SOFTWARE" everywhere, to save the overhead in (a) calling the function and (b) building different strings.
My question...is anyone aware of any circumstances where my change would actually cause failures?
Note that I do understand the difference between creating a new key in lowercase vs uppercase...but I'm talking here strictly about opening existing keys for reading only...
|
|
|
|
|
Daniel Desormeaux wrote:
My question...is anyone aware of any circumstances where my change would actually cause failures...but I'm talking here strictly about opening existing keys for reading only.
I've used mixed-case successfully.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Daniel Desormeaux wrote:
My question...is anyone aware of any circumstances where my change would actually cause failures?
For Last 1 yr, I have used registy in almost each of my project and almost each of Window Platform ranging from 95 to XP, I believe, I never face problem with case sensitivity
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
In .Net, you can retrieve the code page for a given character encoding as follows:
<br />
Encoding blah = Encoding.GetEncoding("utf-7");<br />
<br />
Is there a similar function in Win32 or MFC?
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Jack Squirrel wrote:
Is there a similar function in Win32 or MFC?
How about GetCPInfo() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Doesn't work.
I'm extracting the encoding attribute from an XML file, afterwhich I need to figure out which Windows code page is needed to convert the text to Unicode.
In theory:
<br />
UINT AfxCharacterEncodingToCodePage(LPCTSTR lpszCharacterEncoding)<br />
{<br />
if (_tscicmp(lpszCharacterEncoding, _T("utf-7") == 0)<br />
return (65000);<br />
...<br />
<br />
}<br />
<br />
...<br />
<br />
CString strExtractedCharacterEncoding = _T("utf-7");<br />
<br />
UINT nCodePage = AfxCharacterEncodingToCodePage(strEncoding);<br />
MultiByteToWideChar(nCodePage, blah...);<br />
<br />
I found this list of encodings and their associated code pages, I just don't want to write a function for this if it already exists.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
The IMultiLanguage2 Interface might be of help.
Interface Information
Stock Implementation: mlang.dll
Custom Implementation: No
Inherits from: IUnknown
Header and IDL files: mlang.h, mlang.idl
Minimum availability: Internet Explorer 5
Minimum operating systems: Windows 95, Windows NT 4.0, Windows CE 4.0
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I'm writing a small VC++ program that works with a single dialog, and I wanted the buttons inside the window to move position, when the user resizes the window, but I don't know how to do that. I know that I must use the Resize message of the window, and then move the buttons to the right position , using some arithmetics, but I don't know how to move buttons from place at runtime. Could you help me?
|
|
|
|
|
Check this [^]article and see if that helps you.
Artificial intelligence is no match for natural
stupidity.
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
Thanks, I didn't know I could find supperior inteligence here. I thought I could only find it in some mudhole in Mars.
|
|
|
|
|
I am working with a tree control on a dialog i created. The following code is how i set up the tree in the OnInitDialog() (m_SectionTree is the name of my control):
TVINSERTSTRUCT tvInsert;
tvInsert.hParent = NULL;
tvInsert.hInsertAfter = NULL;
tvInsert.item.mask = TVIF_TEXT;
tvInsert.item.pszText = _T("Circular");
HTREEITEM hCircular = m_SectionTree.InsertItem(&tvInsert);
m_SectionTree.InsertItem(_T("Circular 1"), hCircular, TVI_SORT);
m_SectionTree.InsertItem(_T("Circular 2"), hCircular, TVI_SORT);
etc....
But when i use the program and colapse part of the tree and then try to redraw it again it doesnt redraw correct. It just freezes and redraws the control in a completely random way.
How do i fix this?
thank you
|
|
|
|
|
I am creating a little setup console application in C++. The application is called from autorun on a cd-rom. Once called, the application opens an html page and wait for the html page to be closed and start another setup program. The problem I have is that when someone accidentally eject the CD and reinsert it, the same html page is launch again. Is there a function that I can call to see if the html file is already opened and not open another html file if the first one is still open? I open the html page using ShellExecuteEx(), wait for the page to be closed using WaitForSingleObject(), and launch the second setup program using CreateProcess(). Any help would be appreciated, thanks.
|
|
|
|
|
What happens if you try and open the .html file using OpenFile(..., OF_SHARE_EXCLUSIVE) ? If that fails then you know the file is already open.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Detect that the CD was ejected and then automatically close the web page.
If they re insert it then it re-starts the process.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
How do I detect that the CD was ejected and what can I use to close the file with? Right now my code looks like this:
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si)); // Zero out STARTUPINFO structure.
si.cb = sizeof(si); // Get size of STARTUOINFO structure.
ZeroMemory(&pi, sizeof(pi)); // Zero out PROCESS_INFORMATION structure.
// Set up SHELLEXECUTEINFO structure.
SHELLEXECUTEINFO sInfo = {0};
sInfo.cbSize = sizeof(SHELLEXECUTEINFO);
sInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
sInfo.hwnd = NULL;
sInfo.lpVerb = "open";
sInfo.lpFile = Path;
sInfo.lpParameters = "";
sInfo.lpDirectory = NULL;
sInfo.nShow = SW_SHOWMAXIMIZED;
sInfo.hInstApp = NULL;
if (!ShellExecuteEx(&sInfo))
{ // Print error message if ShellExecuteEx failed.
printf("ShellExecuteEx failed (%d).\n", GetLastError());
} // Print error message if ShellExecuteEx failed.
WaitForSingleObject(sInfo.hProcess, INFINITE); // Wait for hta window to be closed.
if (!CreateProcess(0, Path, 0, 0, FALSE, NORMAL_PRIORITY_CLASS, 0, 0, &si, &pi))
{ // Print error message if CreateProcess failed.
printf("CreateProcess failed (%d).\n", GetLastError());
} // Print error message if CreateProcess failed.
|
|
|
|
|
The other process may not really have the file open anymore, it could have read it into memory and closed it.
The one question I have though is if the CD is removed, can you continue your installation? If so, then perhaps the single instance check that Blake Miller proposed is all you need. If not, then I'm not saying you shouldn't implement that you probably should implement that either way, however if it is an issue that you can't continue your installation after the CD was ejected, then I would pop up an error message "CD Ejected, Installation Canceled" and you could even make it a modal parent of the application you just launched.
To close the application is a tough one. The simplest method is simply "TerminateProcess", but that's a rough one and usually a last resort. There is a support article on MSDN that specifies the steps you could do to attempt to shut down an application peacefully.
Terminate an application cleanly[^]
You could do a simple polling to check if a file is on the CD until it fails, but that is kind of ugly. I haven't looked into seeing if there is a callback I would search the windows messages or perhaps WM_DEVICECHANGE may even work.
Registration for device Removals[^]
Alternatively, you could lock the drive so you can't eject then re-enable it after you're done.
Check this URL out for all the IOCTLs:
Locking the drive from being ejected[^]
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
While our setups were waiting for another program to finish, we created a special mutex.
If your AutoRun saw that this special mutex existed, then we did not launch our setup again. We assumed it was still running. Our setup ALSO checked for this mutex, in case the user accidentally started the setup program twice. Either way, it works well enough for not allowing your setup program to be running more than once. You can look at some of the 'limit program to a single instance' examples here on CodeProject.
|
|
|
|
|
i rying to code project provided here about process monitoring but it doesn't work i don't now may be th .dll or psapi.h ,psapi.lib ,kernal32.h
not working so th program not working if someone can help me by sending me this files..
this link is the project
http://www.codeproject.com/threads/A_not_so_simple_firewall.asp[^]
|
|
|
|