|
Yeah. Right now I'm coding to death . No lunch here.
I hope I'll soon have something good...
_____________________________
...and justice for all
APe
|
|
|
|
|
I have a problem with using COM in my application. For example, I create a simple dialog-based application in VC6 and I want to use COM here. What header files and where do I have to add, may be something I have to change in project settings.
|
|
|
|
|
Just make sure you call CoInitialize[Ex] to create a COM apartment and CoUnInitialize to destroy it (before exiting your app).
It can do no harm to include comdef.h if you want to use some of the COM helper classes such as _variant_t.
Also, you might want to set the _WIN32_DCOM preprocessor directive which will include all the relevant COM headers.
Hope that helps...
|
|
|
|
|
Is there any Windows API to enable hibernation support?
I survey the "Power Management" part of MSDN,
and find that IsPwrHibernateAllowed() function can get
the status of hibernation support.
But I don't find fuction or other way to set the hibernation support
Jesa
|
|
|
|
|
Hi,
look at SetSystemPowerState function. This allows you either to set the system into Stand-by or hibernate states.
MSDN Says:
The SetSystemPowerState function suspends the system by shutting power down. Depending on the ForceFlag parameter, the function either suspends operation immediately or requests permission from all applications and device drivers before doing so.
...
The calling process must have the SE_SHUTDOWN_NAME privilege.
Hope that helps
|
|
|
|
|
hi ,
i use the following code which works fine in Debug mode.
AFX_MODULE_STATE *pstMngSt;
pstMngSt = AfxGetStaticModuleState();
AFX_MANAGE_STATE(pstMngSt);
AfxSetModuleState(pstMngSt);
m_hInstance = pstMngSt->m_hCurrentInstanceHandle;
But when i use the same in Release version, i get
error LNK2019: unresolved external symbol "public: __thiscall AFX_MAINTAIN_STATE2::~AFX_MAINTAIN_STATE2(void)" (??1AFX_MAINTAIN_STATE2@@QAE@XZ) referenced in function "public: void __thiscall CModeMGMT::DispatchDllMsg(struct HWND__ *,unsigned int,unsigned int,long)"
Any library file to be included ?? Pls help me..
Thx
Sugu
|
|
|
|
|
The easiest way to solve this problem is to compare the DEBUG settings with the RELEASE settings.
You will find that you have additional DEBUG libraries that are missing from the RELEASE settings. Add these to the RELEASE settings and all should be OK. I would advise you clean and rebuild the project (after you have made the changes).
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Is it quaranteed that operations to basic datatypes are atomic? Or can I safely do the following:
<br />
INT g_i;<br />
<br />
void main()<br />
{<br />
...<br />
...<br />
}<br />
<br />
DWORD WINAPI ThreadProc(LPVOID lpParameter)<br />
{<br />
...<br />
g_i++;
...<br />
}<br />
I started wondering this after noticed functions such as InterlockedIncrement in MSDN. Where are these functions used? I have always thought that individual increase statement as above are always atomic..
Cohen
|
|
|
|
|
that will most likely crash eventually, especially on a multi processor box
You should use InterlockedIncrement or a critical section
|
|
|
|
|
No. The assembly opperation is something like this: (on some silly machine that I just made up on the spot, but most CPU instruction sets are similear).
10: read memory location X into register
20: add 1 to register
30: store register into memory at location X
Notice there are 3 steps. Now remember that the Pentium 4 has something like 30 stages in the pipeline, I don't know exactly how they do this operation, but there could be 30 cycles between loading the memory and the store! Thats a lot of time for something else to happen.
One thing that could happen is at 20: your timeslice runs out and the OS switches the other thread in, which then manipulates X (particularly changing the value of X!) before your thread gets run again where you write your X, which had 1 added to it.
This is worse if your compiler is really smart, it might notice that you are manipulating g_i all over in that section of code, so the compiler loads g_i into a register, changes the value, but doesn't write it into memory right away, instead it uses the register. There are a lot of rules about when and how a compiler can do this, and most are not smart enough to make it s large problem, but unless you are locking g_i in your code the compiler has no way to know that you expect two threads to access it at the same time.
I suppose there might exist an architcure where there is an atomic incriment memory operation, but if so I have never seen it. That wouldn't surprize me, I've only done assembly on 4 platforms (only one that I compiled, the rest where simplified versions of a real machine for a homework but it was never compiled)
|
|
|
|
|
using regex++ is it possible to do search and replace just the case of the text?
For example if I had:
I was HeRe, BuT NOw i'm GONE!!!
could a regex convert it to...
i was here, but now i'm gone!!!
How owuld I accomplish this using regex???
TIA!!!
How do I print my voice mail?
|
|
|
|
|
i dont know but how about CString::MakeLower() or ctype::tolower from the stl
|
|
|
|
|
Has to be a regex
How do I print my voice mail?
|
|
|
|
|
I don't know regex++ library, but in Perl, you'd do it with a translation regular expression, like this:-
$var = "I was HeRe, BuT NOw i'm GONE!!!";
$var =~ tr/[A-Z]/[a-z]/;
=~ is the reg.exp. operator
tr means translation
[...] group character classes
A-Z is the character class for UPPER CASE
a-z is the character class for lower case.
Bob is therefore your mother's brother.
#include <beer.h>
|
|
|
|
|
|
Hi,
Wt r HotKeys and wt r Shortkeys ?
as i guess that start with Alt r short keys
and that start with Ctrl and Shift r Hotkeys
Is it ???
thanx
Regards.
|
|
|
|
|
Short cut keys are the "key" or "key combinations" that can be used instead of actual action e.g."Alt+F+P" prints a document in word; the acual action is clicking file menu and then selecting print option. (they are short cut to an action)
Hotkeys are related to what we see at screen (not in menus) a character within a text with an underline, pressing that character activates thet particular action. They are single character.
kriaz.
|
|
|
|
|
kriaz wrote:
."Alt+F+P" prints a document in word
i'm a quite "off topic" but the '+' caracter in such expressions means that the keys are pressed at the same time ; in the case of the print action in Word, the key combinations should be : "Alt, F, P ".
TOXCCT >>> GEII power
|
|
|
|
|
2 threads
first threads,DllRegisterServer the 1.ocx(MFC),then FreeLibrary it; and 2.ocx,3.ocx.....
secend threads,DllRegisterServer the A.ocx(MFC),then FreeLibrary it; and B.ocx,C.ocx.....
A thread deadlock in GetModuleFileName when another thread is in FreeLibrary.The GetModuleFileName is called by
DllRegisterServer.-_-!
why???? MFC's Bug?GetModuleFileName is a API!!!!!!
|
|
|
|
|
The DLLMain is only supposed to be called for a single thread within a process at a time.
If you are loading and freeing libraries from various threads, none of those libraries should have ANY dependencies upon each other, or you will see strange results.
Also, no threads that are 'created' within the DllMain context will actualy start running until the DllMain that created the thread returns.
This could be part of your problems.
|
|
|
|
|
1、The libraries have not any dependencies upon each other.
2、Threads aren‘t created in the DllMain.
The thread really is deadlock in "GetModuleFileName" and FreeLibrary.
The GetModuleFileName is called in DllRegisterServer(MFC).
If DllRegisterServer isn't called in thread, the thread can't deadlock.You can test it.
|
|
|
|
|
HI,
I have posted my query that how can i use gif images as a skin on dialogs.
Bcoz there r many examples on CP abut BMP image as skin
some one said me same as BMP files but decompress the gif file.
i want to know how can i decompress that file ,, n how to use
guid me in proper steps .. Plz
any sample code there.
thanx
Regards.
|
|
|
|
|
I'm trying to programatically create an email using the current mail client, with an attachment. I don't want to send the mail from my program, because I'd like the user to customize his mail after my program starts the mail and adds the attachment for him.
Isn't there a simple way to simply duplicate the 'Send To Mail Recipient' functionality in Explorer?
Maybe there is a way I can simulate someone performing this action from my program, to get the desired results?
I've seen some samples on here, but they all work independent of the mail client, which is the opposite of what I need. Thanks!
|
|
|
|
|
try to use WriteProcessmemory() func and make the explorer do all the dirty work :DD
gabby
|
|
|
|
|
hello all,
i have the following code to print the excel file
<br />
VARIANT tv;<br />
VARIANT tv1;<br />
VARIANT tv2;<br />
VARIANT tv3;<br />
VARIANT tv4;<br />
VARIANT tv5;<br />
VARIANT tv6;<br />
VARIANT tv7;<br />
<br />
tv3.vt = VT_BOOL;<br />
tv3.iVal = false;
<br />
tv4.vt = VT_BSTR;<br />
tv4.bstrVal = printerName.AllocSysString();
<br />
tv5.vt = VT_BOOL; <br />
tv5.iVal = false;
<br />
tv6.vt = VT_BOOL;<br />
tv6.iVal = true;
<br />
tv7.vt = VT_BSTR;
tv7.bstrVal = CString("").AllocSysString();<br />
<br />
tv.vt = VT_I4;<br />
tv.lVal = 1;
<br />
tv2.vt = VT_I2;<br />
tv2.iVal = 1; <br />
<br />
sheets.PrintOut(covOptional, covOptional, tv2, tv3, tv4, tv5, tv6, tv7 );<br />
the excel file contains charts and it is giving me error. if there is no charts i don't get error at all and it is printing.
why is it chart giving me error?
|
|
|
|