|
SetLayeredWindowAttributes tkes a HWND, can you pass in th HWND of the controls to set them to be solid ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I tryed it before, but unfortunately when the HWnd is a handle to a child window It does not work. (however SetWindowLong works!)
Thankyou, at least one cpian (wow a MVP) answered after 2 times of trying.
|
|
|
|
|
Easy answer: You can't. SetLayeredWindowAttributes() only works for top-level windows, and effect all children.
A solution: You can use two dialogs, and carefully keep them positioned so that one is always directly above the other. Set the "bottom" dialog to be translucent, set the window region of the upper one to clip out everything except the controls (you could also use SetLayeredWindowAttributes() with a color key to accomplish this). You'll then see past the (fully-visible) controls through the translucent background to whatever is behind them.
Another solution: Draw the entire dialog yourself using UpdateLayeredWindow() (perhaps sending WM_PRINT messages to render the child controls). This is the most flexible, you can have varying alpha across the window. It is quite likely the most work as well.
|
|
|
|
|
Hi,
Thankyou. Get my 5!
I have been thinking to answer 1 but personally, did not like it!!
Solution #2 might be a better approach, however I've not been working with UpdateLayeredWindow yet!! I know something of WM_PRINT , I used it before in my codes ( for a better alpha blending ). If you have time, would it be possible to describe the process more clearly! (How should I render child controls?)
Thank you. Thank you very much, indeed.
|
|
|
|
|
Hamed Mosavi wrote:
If you have time, would it be possible to describe the process more clearly! (How should I render child controls?)
I wish i could give you a more complete answer, but while it's something i've put a bit of thought into, i've never gotten around to actually trying to implement it (the second solution, that is). The idea is, all the standard controls will respond to WM_PRINT by rendering themselves into the specified device context. If you can detect (or correctly predict) when they need to be redrawn, you can maintain an offscreen bitmap containing the current appearances of all the children, and use UpdateLayeredWindow() to update the screen with this. In practice, it would probably work better with some controls than with others.
You must be careful in the forest
Broken glass and rusty nails
If you're to bring back something for us
I have bullets for sale...
|
|
|
|
|
Dear Mr. Shog9,
Hi!
Thank you very much to have this kindness, you helped me alot. At least I have a clue to follow now and in my humble opinion It's value is times and times more than these 5's (votes).
I think finding code proect has been a great chance in my life
Best regards.
[I've read some of your articles, they are nice. I'm engaged with writing an article at the moment.My first one!! Pray for me, Please!!]
|
|
|
|
|
I've fought my way through to building DCMTK, which is a cross platform DICOM toolkit that I am suddenly saddled with. Now I try to build my main project, which uses it, and I get these linker errors:
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: char const * __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::c_str(void)const " (?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: char & __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::operator[](unsigned int)" (??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAADI@Z) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: unsigned int __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::size(void)const " (?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_ostringstream<char,struct std::char_traits<char="">,class std::allocator<char> >::`vbase destructor'(void)" (??_D?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ) already defined in dcmdata.lib(dcitem.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char=""> > & __thiscall std::basic_ostream<char,struct std::char_traits<char=""> >::operator<<(int)" (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > __thiscall std::basic_ostringstream<char,struct std::char_traits<char="">,class std::allocator<char> >::str(void)const " (?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ) already defined in dcmdata.lib(dcitem.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char=""> > & __thiscall std::basic_ostream<char,struct std::char_traits<char=""> >::operator<<(double)" (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@N@Z) already defined in dcmimgle.lib(dimomod.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_ostringstream<char,struct std::char_traits<char="">,class std::allocator<char> >::basic_ostringstream<char,struct std::char_traits<char="">,class std::allocator<char> >(int)" (??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z) already defined in dcmdata.lib(dcitem.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::operator+=(char)" (??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@D@Z) already defined in dcmimgle.lib(didispfn.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::_Container_base::~_Container_base(void)" (??1_Container_base@std@@QAE@XZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::_Container_base::_Orphan_all(void)const " (?_Orphan_all@_Container_base@std@@QBEXXZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::_Container_base::_Container_base(void)" (??0_Container_base@std@@QAE@XZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char=""> > & __thiscall std::basic_ostream<char,struct std::char_traits<char=""> >::operator<<(class std::basic_ostream<char,struct std::char_traits<char=""> > & (__cdecl*)(class std::basic_ostream<char,struct std::char_traits<char=""> > &))" (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char=""> > & __thiscall std::basic_ostream<char,struct std::char_traits<char=""> >::operator<<(unsigned int)" (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@I@Z) already defined in dcmdata.lib(dchashdi.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char=""> > & __cdecl std::endl(class std::basic_ostream<char,struct std::char_traits<char=""> > &)" (?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_ios<char,struct std::char_traits<char=""> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::ios_base::width(int)" (?width@ios_base@std@@QAEHH@Z) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char=""> >::sputn(char const *,int)" (?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: static bool __cdecl std::char_traits<char>::eq_int_type(int const &,int const &)" (?eq_int_type@?$char_traits@D@std@@SA_NABH0@Z) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: static int __cdecl std::char_traits<char>::eof(void)" (?eof@?$char_traits@D@std@@SAHXZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char=""> >::sputc(char)" (?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_streambuf<char,struct std::char_traits<char=""> > * __thiscall std::basic_ios<char,struct std::char_traits<char=""> >::rdbuf(void)const " (?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: char __thiscall std::basic_ios<char,struct std::char_traits<char=""> >::fill(void)const " (?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDXZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::ios_base::flags(void)const " (?flags@ios_base@std@@QBEHXZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: int __thiscall std::ios_base::width(void)const " (?width@ios_base@std@@QBEHXZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: static unsigned int __cdecl std::char_traits<char>::length(char const *)" (?length@?$char_traits@D@std@@SAIPBD@Z) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char=""> > & __thiscall std::basic_ostream<char,struct std::char_traits<char=""> >::flush(void)" (?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char=""> > * __thiscall std::basic_ios<char,struct std::char_traits<char=""> >::tie(void)const " (?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: bool __thiscall std::ios_base::good(void)const " (?good@ios_base@std@@QBE_NXZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_ostream<char,struct std::char_traits<char=""> >::_Osfx(void)" (?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char=""> >::_Lock(void)" (?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in dcmimage.lib(diyp2img.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char=""> >::_Unlock(void)" (?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in dcmimage.lib(diyp2img.obj)
libcpmtd.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ) already defined in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(void)" (?_Init@locale@std@@CAPAV_Locimp@12@XZ) already defined in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "private: static void __cdecl std::locale::facet::facet_Register(class std::locale::facet *)" (?facet_Register@facet@locale@std@@CAXPAV123@@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,char const *)" (?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@PBD@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_dtor(class std::_Locinfo *)" (?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::operator=(char const *)" (??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(xdebug.obj) : error LNK2005: "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(xdebug.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??_U@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(ios.obj) : error LNK2005: "private: static void __cdecl std::ios_base::_Ios_base_dtor(class std::ios_base *)" (?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(ios.obj) : error LNK2005: "public: static void __cdecl std::ios_base::_Addstd(class std::ios_base *)" (?_Addstd@ios_base@std@@SAXPAV12@@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP80D.dll)
Both my project and the toolkit are compiling as multi threaded. The work I'm doing is introducing the STL to this code, removing headers like iostream.h, etc.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
Do you have any other libraries, which is linked with your application? We faced similar issues long time back..
I am just sharing what was our problem and how did we fixed it. It might help you..
We have a MFC application which is compiled as a Single threaded model..
You can see this in Visual Studio 6.0 MSDev Project Setting-->C/C++ tab-> Category : Code Generation and Use runtime library combo button..
WE had another library which is mistakenly set as Multi threaded library and linked with our MFC aplication..
Hence the application has two versions of standard librarires, one is for single threaded and another one is for multi threaded.. So the ambiguity hence linker error.
What you can do is Check for "Use Runtime Library" options for your every C++ library you are using, your project etc...
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
I appreciate the help, but I've already checked, both are multi threaded.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Totally a wild guess, but what if you try linking statically?
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
You mean link statically to MFC ? I can't see any options for static linking ( VS2005 )
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
To whatever, MFC, the CRT.... it's just a guess, since I don't have VS2005 installed (I have the DVD right in front of me, but I guess that doesn't help much ).
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Christian,
I just created a MFC project with VS2005 and at the bottom of the "Project" menu the last item has the project properties. The MFC option is under "Configuration Properties" -> "General".
Elaine
The tigress is here
|
|
|
|
|
Does building in release mode help?
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
I need to get all sharing folders in network.I think , not sure, The NetFileEnum() not support in windows 95,98.Please tell me the solution ,it also work in windows 95,98.
Thank You.
|
|
|
|
|
Hi,
I set some breakpoint in my code:
[code]
//myfirst.h
class CMyApp:public CWinApp
{
public:
virtual BOOL InitInstance();
};
class CMyFrameWnd:public CFrameWnd
{
public:
CMyFrameWnd();
protected:
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP()
};
//////////////////////////////////////////////////////////////////////////
#include <afxwin.h>
#include "myfirst.h"
CMyApp theApp;
BOOL CMyApp::InitInstance()
{
m_pMainWnd = new CMyFrameWnd;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
BEGIN_MESSAGE_MAP(CMyFrameWnd, CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
CMyFrameWnd::CMyFrameWnd()
{
Create(NULL, _T("myfirstMFC"));
}
void CMyFrameWnd::OnPaint()
{
CPaintDC dc(this); //here I can't understand!!
CRect rect;
GetClientRect(&rect);
dc.DrawText(_T("MFC"),-1,&rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
}
[/code]
and I see the context in the call stack window just like below:
---------------------------------------
CWnd::OnWndMsg(unsigned int 129, unsigned int 0, long 1244260, long * 0x0012fb1c)
CWnd::WindowProc(unsigned int 129, unsigned int 0, long 1244260)
AfxCallWndProc(CWnd * 0x023e4ed8 {CMyFrameWnd hWnd=0x00100552}, HWND__ * 0x00100552, unsigned int 129, unsigned int 0, long 1244260)
AfxWndProc(HWND__ * 0x00100552, unsigned int 129, unsigned int 0, long 1244260)
USER32! 77e2158f()
USER32! 77e1c19d()
USER32! 77e122c5()
NTDLL! 77f91baf()
USER32! 77e064b5()
BCCORE! 0c067fa0()
CFrameWnd::Create(const char * 0x00000000, const char * 0x004f001c, unsigned long 13565952, const tagRECT & {top=-2147483648 bottom=0 left=-2147483648 right=0}, CWnd * 0x00000000 {CWnd hWnd=???}, const char * 0x00000000, unsigned long 0, CCreateContext * 0x00000000)
CMyFrameWnd::CMyFrameWnd()
CMyApp::InitInstance()
AfxWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00132f73, int 1)
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00132f73, int 1)
WinMainCRTStartup()
KERNEL32! 77e88989()
---------------------------------------
in the call stack window I can relatively clearly see a MFC-based Application programe is how to execute:
While the problem is:
I don't know what's KERNEL32! 77e88989()mean
and I don't know how the Message Map is occur?
who I help me??
shanzy
|
|
|
|
|
shanzy1980 wrote:
I don't know what's KERNEL32! 77e88989()mean
It means a call to the Kernel32 dll, I believe. Something you don't have source for. ( You have the MFC source, you see ).
shanzy1980 wrote:
and I don't know how the Message Map is occur?
The CWnd class wraps a Win32 message loop, MFC is just a Win32 wrapper, after all.
shanzy1980 wrote:
CWnd::OnWndMsg
That looks suspiciously like the place that Windows messages end up.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thank you,let me think for a while
shanzy
|
|
|
|
|
I want to share the folder programatically .please tell me how it is possible .
Thank you.
This allows you to set your preferences for the discussion boards
|
|
|
|
|
I need to update a global variable that gets manipulated in InitInstance() and a wrapper function. The variable is initialized to FALSE in the main constructior but gets set to TRUE in the wrapper function. Both threads are reading the variable in InitInstance causing a race condition.
How can I grant priority to the thread that belongs to the wrapper class? I created a mutex in the main constructor for all threads to access. In the wrapper function, I have the following code:
STDMETHODIMP CWrapper::StartApplication(DataNotificationType notifyType, VARIANT data)
{
HANDLE openMutex;
openMutex = ::OpenMutex(0, FALSE, "notify");
DWORD dwMutexErr = GetLastError();
if (dwMutexErr == ERROR_FILE_NOT_FOUND)
AfxMessageBox("cannot open mutex");
else
{
WaitForSingleObject(mutex_handle,INFINITE);
variableToUpdate = TRUE;
}
....execute some program.exe....
ReleaseMutex(mutex_handle);
}
BOOL CMainApp::InitInstance()
{ .....
if (variableToUpdate)
{
....code...
}
}
Thanks!
|
|
|
|
|
elephantstar wrote:
How can I grant priority to the thread that belongs to the wrapper class
Maybe use an event instead of a mutex that blocks your low prio thread, and only set the event when the wrapper class thread is done ?
~RaGE();
|
|
|
|
|
I created a mutex to make sure only one instance of the app in running. The variable that needs to be updated determines whether or not to create the mutex. Right now, that variable is being set to TRUE in the wrapper class. Once it's set to TRUE, CreateProcess is called to run the app within the wrapper function at the same time the main app is also running and reading in the variable that was initially set to FALSE. How would I create an event in InitInstance to run the second thread that will call InitInstance via CreateProcess? I'm just a little confused how all this works. I didn't think about using events or a mutex for synchronizing the variable until I removed my AfxMessageBox code that was used for debugging purposes. I guess it put a delay in the thread causing it to read the desired variable value.
|
|
|
|
|
HI~~
i have a Q about analyse a string type of CString.
the string was <伯 YはY><夷 YいY><叔 YしゆY><斉 YせいY><餓 OウO K哀K>于<首 YしゆY><陽 YやうY>之<下 YもとY O二O K亜K M。M>
i want get the CStringList list;
list[0]=伯;
list[1]=夷;
list[2]=叔;
.....
code like this:
while(!ado.pRtr->adoEOF)
{
var=ado.pRtr->GetCollect("SHOMON_BUN");
m_Text=(LPCSTR)_bstr_t(var);
int len=m_Text.GetLength();
while(!len==0)
{
//i don't know how can i do
}
list.AddTail(m_Text);
ado.pRtr->MoveNext();
}
thanks in advance very much~~!
nothing
|
|
|
|
|
ebinaini wrote:
i have a Q about analyse a string type of CString.
the string was...
What is it that you are wanting to analyze?
ebinaini wrote:
while(!len==0)
What are you trying to check for here?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Just curious, but when would this occur?
I figure typically it would be caused by a faulty harddrive like a bad sector which hasn't been flagged as such by defrag or scandisk???
I am way off or dead on???
Just curious, thanks
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|