|
I'm trying to modify the style(CBS_SORT) of a combo box control inside a dialog box at run time. Its seems its not updating? I added the ModifyStyle function inside the InitDialog of the Dialogbox. Is there something I'm missing?
Thanks
|
|
|
|
|
as i tested before, it can not be changed at runtime, may be i (and u) lost something.
my poor solution is:
use 2 combo-boxes, hide one and show one as requested.
includeh10
|
|
|
|
|
I’ve got a .dll from my supplier that I am trying to create a instance of. (I’m not realy good att dll’s).
How may I search for errors when my call to: CreateInstance(…) fails
I know it would return a HRESULT and that the value is 1 on those cpu-s which it don’t work on. The call work properly on my developing machine.
I surely have registered the dll on those cpu-s the call fails.
Pleased for any suggestions…
...and justice for all
APe
|
|
|
|
|
d00_ape wrote:
I’ve got a .dll from my supplier...
Does the DLL's supplier have any suggestions?
d00_ape wrote:
I surely have registered the dll on those cpu-s the call fails.
What about any controls that the DLL uses that might need to be registered?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
The supplier is unfortunately not contactable in about three weeks…
I've checked dependencies using "Dependency Walker" and all seems OK.
...and justice for all
APe
|
|
|
|
|
d00_ape wrote:
The supplier is unfortunately not contactable in about three weeks…
So how about contacting them before the three weeks are up?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
sorry not "in". Ment after...
...and justice for all
APe
|
|
|
|
|
Have you called the CoInitialise(...) before createing the object ?
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
My codeline before is:
//Init OLE
CoInitialize(NULL);
// then CreatiInstance(...)
...and justice for all
APe
|
|
|
|
|
I have set WH_CBT in a dll,problem happened in his call back function:
LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if(nCode==HCBT_ACTIVATE)
{
CWnd * pWnd; // Ö¸Õë
HWND hwnd; // ¾ä±ú
DWORD dwNewProcId,dwReturn;
hwnd = (HWND)wParam; // Active Window Handle
pWnd = CWnd::FromHandle(hwnd);
dwReturn=::GetWindowThreadProcessId(hwnd,&dwNewProcId);
pWndActive = pWnd; // µ±Ç°¼¤»î´°ÌåµÄÖ¸Õë
if (dwReturn > 0)
{
if(bFlag)
{
bFlag=false;//bFlag is a global variant
code else; //and initial value is true,but these code
//are executed every times,why? I have no idea
}
}
}
}
|
|
|
|
|
Did you use a shared data segment?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
You could try putting a breakpoint on bFlag when it is changed. This may show you where the flag is being set to true.
Ant.
|
|
|
|
|
Unless bFlag is in a shared data segment then each process will get its own set of variables for the DLL. So setting it to false only sets it for the current process. Look at http://www.codeproject.com/dll/data_seg_share.asp[^] to see how to create variables in a data segment that is shared between all processes using a DLL.
Mike
|
|
|
|
|
Hi,
Could anyone here recomend a good SDK/Libraries/Sources that will enable me to use IMAP from my application?
I am developing in C++, however I am open to any suggestions.
I have checked componentsource who seem to have a lot of PowerTCP and IPWorks componenets. Is there another site that might have more veriaty?
Thanks,
Jeremy.
Jeremy Pullicino
C++ Developer
Homepage
|
|
|
|
|
i have a c++ sample which generates a active control in exe format, readme says it can be used in VB.
i have no idea how to use it in vb.
if u know VB, please give me a clue for quick start
thx
includeh10
|
|
|
|
|
You mean an ActiveX control ?
I don't know how to use it in VB but try asking at the VB forum.
|
|
|
|
|
in dll.
class a{
CPoint * p;
}
a::a{
p = new CPoint[30];
}
a::~a{
delete p;
}
in exe.
{
A * pa = new a;
delete pa;
}
When the project setting for my application is 'Use MFC in a Shared DLL', there is no problem. But when the setting is 'Use MFC in a Static Library', the compiler gives errors in Released mode, and in Debug mode the .exe is built but this time i face with 'Debug Assertion Failed!'(ASSERT(_crtIsvalidheappoint() ) errors when i run the application.
Thanks for help
|
|
|
|
|
a::~a{
delete[] p;
} You must match forms of new and delete . If you allocated an array, use delete[] . If you allocated a single object, use delete .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I have done it, but it doesn't help.
|
|
|
|
|
Sorry, I should have read more thoroughly. You shouldn't have one binary in the same process linked to the static version of the C runtime library and another linked to the DLL version. If more than one binary uses the C runtime, they should all use the DLL version.
One of many reasons is that the C runtime creates a new operating system heap (using the HeapCreate function) during CRT startup, for all allocations made using the C or C++ runtime libraries. Each instance of the CRT (a statically-linked copy of the CRT counts as a new instance) creates its own heap. See HEAPINIT.C in the CRT source code.
You can't allocate from one heap but free from another. The effect of your code is that the code from a::a (and hence the memory allocation from new ) runs in the context of the code running new a (in this case, your executable), but the memory deallocation runs from the module containing a 's destructor (the DLL). delete therefore tries to free the memory from the wrong heap, leading to the assertion. In a Release build, you won't get the assertion, but you will get a memory leak.
The practical upshot of this is that you must either link all MFC-using components in the same process with the MFC DLL, or never create classes outside the DLL they're implemented in.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks very much! I got it. But I have another question: is there any method to solve "new and delete" problem. In my application, I want to seperate the user interface and the data structure. So I put the data structure in dll and UI in exe. Meanwhile I want to link them both in static library. Is there any method.
|
|
|
|
|
What compiler errors do you get?
What pointer is causing the assertion? (You should be able to 'break' and then look at the call stack)
As pointed out you need to delete an array with delete [].
If the allocation is always 30 why are you using 'new'?
It's possible the problem is related to having your class in a DLL, I'm currently fuzzy on when this matters from a heap pov. Try putting a factory function in your DLL,
A * CreateA ()
{
return new A ;
}
void DestroyA ( A * )
{
delete A ;
} and using that rather than direct 'new' and 'delete'.
In general I'd highly recommend you not use 'new' and 'delete' but use 'std::vector' or another container for the array and 'std::auto_ptr' or another smart pointer for the object.
Paul
|
|
|
|
|
Thanks very much! I got it!
|
|
|
|
|
Hi i want to get HFONT or LOGFONT form HDC object. I have a hdc but i don't wann to do this in this way
<br />
HFONT font= (HFONT)SendMessage( hwnd,WM_GETFONT,0,0);<br />
or in this way
<br />
HFONT font = ::CreateFontIndirect(....);<br />
HFONT hOldFont = (HFONT)::SelectObject(hdc, font);<br />
im looking for something like
<br />
HFONT font=GetFont(hdc);<br />
There must be a way to do this
Pain is a weakness living the body
|
|
|
|
|
Try ::GetCurrentObject(HDC, OBJ_FONT)
Roger Allen - Sonork 100.10016
Strong Sad:
Clever I am? Next to no one.
Undiscovered and soggy.
Look up. Look down. They're around.
Probably laughing. Still, bright, watery.
Listed among the top. Ten.
Nine. Late night. Early morn.
Early mourn. Now I sleep.
|
|
|
|