|
I wrote a regular MFC dll which should display a dialog-box.
I have a class derived from CDialog to display my dialog.
Now, my exported class is a regular one (NOT MFC) which has a method Open to open the dialog.
(I use a regular class since my client is a console application or none-MFC client)
The problem is that i get assert on AfxGetResourceHandle().
When i added the statement "AFX_MANAGE_STATE(AfxGetStaticModuleState( ));"
i got a link error saying:
"mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in RewinderSimulator.obj
mfcs42d.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined in RewinderSimulator.obj".
How can i solve my problem?
Thanks,
Dudi
|
|
|
|
|
I would like to clip one region from another. But how to get points array from HRGN????
|
|
|
|
|
Have a look at CRgn::GetRegionData() .
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
I wrote a little COM dll, that placed on one machine, and client programm on another. The machine where com dll is placed - wiht Windows XP, and client program works properly if it on WIndows XP, and doesn't work if it on Windows 2000 Proffessional or Server, i haven't tried it on another OS. What's wrong am i doing? It shows the messagec "Invalid pointer".
|
|
|
|
|
My first guess would be a missing or unregistered DLL that is used by your DLL.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
But how can it be??? I just call the dll from another computer....
As i said on the Windows XP the client programm works, but on another platform doesnt.
As i understand the DCOM - it should make a connection throught the net, and call the methods of my COM. So, may be deal in ports??? which ports used DCOM? - i've never seen that information...
Or maibe i shoud make the instance of My com another way than CoCreateObject???
|
|
|
|
|
open dilaog after 15 years does not work propertly.
Do a simple app. Make it enter MTA.
Pop up a Common Open/Save File Dialog.
On Win2K Hangs When Selecting topmost My Documents Folder.
On Win XP, By selecting my computer the list view is empty.
On both OS-es sometime list of files is chopped (if does not hang meanwhile).
I would apreciate any workaround.
But after 15 years they could not get it right a ... so common open dialog...
|
|
|
|
|
around.:
[code]
class COd : public CFileDialog
{
public:
COd(BOOL bOpenFileDialog,
LPCTSTR lpszDefExt = NULL,
LPCTSTR lpszFileName = NULL,
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
LPCTSTR lpszFilter = NULL,
CWnd* pParentWnd = NULL):CFileDialog(bOpenFileDialog,
lpszDefExt ,
lpszFileName ,
dwFlags ,
lpszFilter ,
0 )
{
}
int DoModal(){
return CFileDialog::DoModal();
}
BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
BOOL ret = CFileDialog::OnNotify(wParam, lParam, pResult);
OFNOTIFY* pNotify = (OFNOTIFY*)lParam;
switch(pNotify->hdr.code)
{
case CDN_TYPECHANGE:
{
CWnd* pWnd = GetActiveWindow();
CWnd* PDlg = pWnd;
if(pWnd)
{
GetFocus()->PostMessage(WM_KEYDOWN,VK_RETURN,0);
GetFocus()->PostMessage(WM_KEYUP,VK_RETURN,0);
}
}
break;
}
return ret;
}
virtual void OnFolderChange()
{
TCHAR cs[128];
CWnd* pWnd = GetActiveWindow();
CWnd* PDlg = pWnd;
CWnd* PSlv = 0;
int relation = GW_CHILD|GW_HWNDFIRST;
while(pWnd = pWnd->GetWindow(relation))
{
GetClassName(pWnd->m_hWnd, cs,128);
if(!strcmp("SHELLDLL_DefView",cs))
{
CWnd* pSave = pWnd;
int relation = GW_CHILD|GW_HWNDFIRST;
while(pWnd = pWnd->GetWindow(relation))
{
GetClassName(pWnd->m_hWnd, cs,128);
if(!strcmp("SysListView32",cs))
{
PSlv = pWnd;
break;
}
relation = GW_HWNDNEXT;
}
pWnd = pSave;
}
relation = GW_HWNDNEXT;
}
}
};
class DlgWrap
{
public:
DlgWrap(BOOL bOpenFileDialog,
LPCTSTR lpszDefExt = NULL,
LPCTSTR lpszFileName = NULL,
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
LPCTSTR lpszFilter = NULL,
CWnd* pParentWnd = NULL)
{
memset(&m_ofn,0,sizeof(m_ofn));
_cfilter = lpszFilter;
_cfilter.Replace('|', '\0');
m_ofn.lStructSize = sizeof(m_ofn);
m_ofn.lpstrDefExt = lpszDefExt;
m_ofn.lpstrFile = (LPTSTR)lpszFileName;
m_ofn.Flags = dwFlags ;//| OFN_EXPLORER;
m_ofn.lpstrFileTitle = "asdfasd";
m_ofn.lpstrFilter = (LPCTSTR)_cfilter ;
/*
m_ofn.nMaxFileTitle = MAX_PATH;
m_ofn.hwndOwner = pParentWnd->m_hWnd;
m_ofn.lpstrFilter = lpszFilter;
*/
//// m_ofn.Flags = dwFlags | OFN_EXPLORER;
//// strFilter.Replace('|', '\0');
}
UINT DoModal()
{
_hThread = ::CreateThread(0,0,(LPTHREAD_START_ROUTINE)ThrProc,this,0,0);
Sleep(1208);
WaitForSingleObject(_hThread, INFINITE);
return _rv;
}
static UINT ThrProc(void* pThis)
{
OPENFILENAME ofn = {0};
DlgWrap* pDlg = (DlgWrap*)pThis;
HRESULT hr = CoInitialize(0);
memcpy(&ofn, &pDlg->m_ofn, sizeof(ofn));
pDlg->_rv = ::GetOpenFileName(&ofn);
memcpy(&pDlg->m_ofn, &ofn, sizeof(ofn));
CoUninitialize();
return pDlg->_rv;
}
DWORD _rv;
HANDLE _hThread;
OPENFILENAME m_ofn;
CString _cfilter ;
};
[/code]
|
|
|
|
|
I need to disable a CListCtrl item, and can't find out how. It looks like SetItemState() will do it, but I can't find what to set. Any help? Thanks
BW
The Biggest Loser
"Farm Donkey makes us laugh. Farm Donkey hauls some ass." -The Stoves
|
|
|
|
|
I don't think you can actually change an items state to disabled with a default CImageList. You may want to look at some custom control imagelists here on CP, cuz i'm sure you'd have to atleast do some custom drawing.
I wonder if there are any animals that actually have to think in order to breathe? It would really suck to be them!!!
|
|
|
|
|
I don't think you can actually change an items state to disabled with a default CImageList. You may want to look at some custom control imagelists here on CP, cuz i'm sure you'd have to atleast do some custom drawing.
I wonder if there are any animals that actually have to think in order to breathe? It would really suck to be them!!!
|
|
|
|
|
Is there a way to label objects after edge detection? the border of the object is well linked together to formed a closed boundary. ANyone with an algorithm to do this. Please send to me.
|
|
|
|
|
How can I get the name and the path of the executing exe (or dll) at run-time?
Thanks,
Einar
|
|
|
|
|
GetModuleFileName.
Steve S
Developer for hire
|
|
|
|
|
That seems to be what I need but I encountered something unexpected.
I am working on a conduit for Palm Hotsync and if I add the following code to my conduit DLL source code:
TCHAR szFilename[256];
GetModuleFileName(NULL, szFilename, 256);
szFilename is now equal to :
C:\Program Files\PalmSource\Palm OS CDK\Common\Bin\Hotsync.exe
Which is the exe that calls the conduit DLL.
DWORD GetModuleFileName(
HMODULE hModule,
LPTSTR lpFilename,
DWORD nSize
);
According to the helpfile:
hModule [in] Handle to the module whose path is being requested. If this parameter is NULL, GetModuleFileName retrieves the path for the current module.
Any idea what I should use for hModule?
Thanks,
Einar
|
|
|
|
|
If you search your DLL, you will find a function called DllMain.
One of its parameters is HINSTANCE hInstance. You can pass
this to GetModuleFileName.
Iain.
|
|
|
|
|
Excellent. That is just what I needed.
Thank you very much.
Sincerely,
Einar
|
|
|
|
|
Hello Friends,
I want to change the text color of the item present in a Tree control at the run time depending upon some value.
For example I am having a boolean variable
bool bValid = false;
I want set the item text color to red whenever bValid == true;
How can this be done?
Please help me.
thanks in Advance.
Neelesh K J Jain.
|
|
|
|
|
If you look at NM_CUSTOMDRAW for the tree view, it calls the parent for each item.
Along with the message is a NMTVCUSTOMDRAW struct, where you can set the text / back
colours. Part of that is a NMCUSTOMDRAW struct, with parameters identifying the
individual item. The lItemlParam member will likely be some information you have
set using TVM_SETITEM or its like.
You may also find what you want in the Tree View section of this site!
Iain.
|
|
|
|
|
Hello Iain,
Thanks for your reply. I am using CFormView in which I have two controls (i.e., Combobox and TreeControl). I am not having the Customdraw message handler for the control. please help me
Thank you in Advance.
Neelesh K J Jain.
|
|
|
|
|
Hi there,
does anybody know how to change programatically the settings for the serial port FIFO buffer ? I'd like to change it from the default 16 to 1, or even disable it, as it is possible in the WinXP device manager?
I know the way to change it via Registry, but therefore you have to have admin-privilleges and then reboot the system. Is there any API-Function for it, like for the other serial port settings ?
thanks for help
|
|
|
|
|
I haven't done it myself, but it looks like SetCommProperties / COMMPROP
are what you are after.
Iain.
|
|
|
|
|
I have a Split Frame Window in my MSVC++ 6 application. In my OnNewDocument() override, I am calling the SetTitle() function. At any point past that I can call GetTitle() and it will return the correct title that I set, but the title never does appear in the title bar of the frame window. It just displays the program name. Why is this, and how can I display the text I want in the title bar?
Marcos Secca
|
|
|
|
|
Friends,
In case of VC 6.0 we can only use the classes like CString and CTime only in MFC. However in VC 7.0, these can be used in an application without MFC dependency.
I am using VC 6.0 and wants to use the class CTime (without including MFC). Is there any possible way ?? It is included in "atltime.h" which is included with VC-7
Imtiaz
|
|
|
|
|
isn't there a time.h file you can use for VC6 ?
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|