|
chito wrote:
...without using MSDN functions.
Huh? The MSDN is not an API, but it is documentation/examples of several API. By chance did you mean that you wanted to use raw sockets without MFC?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes, I want to use raw sockets with out using MFC.
Thanks,
Chito
|
|
|
|
|
Ok, so how about:
connect()
send()
recv()
accept()
etc
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
We constructed ATL wizards for VC++ 6.0.
We now have to upgrade them to .NET .
From our first trials we identified that some directories have changed, some keywords were updated, but we found very little information in MSDN documentation about general aspects of the process.
For example, there are numbers to give in some files and we found no indications on what are authorized numbers, the risks of conflicts and so on.
Do you know of documents dealing with this upgrade issues ?
|
|
|
|
|
I detect the system log off message according to following codes
LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_QUERYENDSESSION)
{
if (lParam & ENDSESSION_LOGOFF)
{
//I want to restart windows,but failed by call ExitWindowsEx(EWX_LOGOFF|EWX_FORCE,0);
//I have got the shutdown privilege for this process
}
}
return CFrameWnd::WindowProc(message, wParam, lParam);
}
how can ?
|
|
|
|
|
Marks_Zhua wrote:
...but failed...
This means nothing without a more detailed explanation. Are you getting compiler errors? Linker errors? Fired assertions? Thrown Exceptions? Unexpected results? What exactly is happening?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
For ExitWindowsEx you need to have the SeShutdownPriviledge enabled in your process token.
have a nice weekend!
|
|
|
|
|
I want to remove Close button "X" from the right corner of Dialog, but still want to keep the system menu at the left corner. Unchecking the system menu option from dialog properties also removes the menu at left.
Plz Help.
kriaz.
|
|
|
|
|
I know of no way to remove the "X" while keeping the system menu. You can always just ignore the clicking of the "X".
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Is there anybody who can tell me how i can set the paper-orientation of the
printer. I have searched some different books or sites about the printing-subject but i haven't found anything about setting of the orientation.
J Vriend
e-mail: JVriend@ooms.nl
|
|
|
|
|
There you go... I have found it somewhere in CP but cannot remember where.. so apologies to the person who deserves credits!
<br />
void CYourApp::SetPrintOrientation(bool isLandscape)<br />
{<br />
if ( isLandscape )<br />
{<br />
PRINTDLG pd;<br />
pd.lStructSize = (DWORD)sizeof(PRINTDLG) ;<br />
BOOL bRet = GetPrinterDeviceDefaults(&pd) ;<br />
if (bRet)<br />
{<br />
DEVMODE *pDevMode = (DEVMODE*)::GlobalLock(m_hDevMode) ;<br />
pDevMode->dmOrientation = DMORIENT_LANDSCAPE ;<br />
::GlobalUnlock(m_hDevMode) ;<br />
}<br />
}<br />
else<br />
{<br />
PRINTDLG pd;<br />
pd.lStructSize = (DWORD)sizeof(PRINTDLG) ;<br />
BOOL bRet = GetPrinterDeviceDefaults(&pd) ;<br />
if (bRet)<br />
{<br />
DEVMODE *pDevMode = (DEVMODE*)::GlobalLock(m_hDevMode) ;<br />
pDevMode->dmOrientation = DMORIENT_PORTRAIT ;<br />
::GlobalUnlock(m_hDevMode) ;<br />
}<br />
}<br />
}<br />
And does someone know how tabs can be displayed properly in CP?
|
|
|
|
|
> And does someone know how tabs can be displayed properly in CP?
Try using <pre> rather than <code> to surround your code snippets .
--
Andrew.
|
|
|
|
|
I’m about to make a SAFEARRAY and pas it into a this function:
<br />
void IAcadSelectionSet::AddItems(const VARIANT& pSelSet)<br />
{<br />
static BYTE parms[] =<br />
VTS_VARIANT;<br />
InvokeHelper(0x7, DISPATCH_METHOD, VT_EMPTY, NULL, parms,<br />
&pSelSet);<br />
}<br />
At first I don’t really know why I know the pSelSet is a SAFEARRAY.
I know I have to do something like:
<br />
VARIANT var;<br />
VariantInit( &var );<br />
var.vt = VT_ARRAY;<br />
But when I do then do this call:
<br />
myIAcadSelectionSet.AddItems( var );<br />
it craches!!
Of course the array is empty but would the call crash cause of that?
I’m soon clear with the meaning of COM-calls but now I’m stucked.
_____________________________
...and justice for all
APe
|
|
|
|
|
This will generate a safe array of BSTRs. Hope the example helps.
VARIANT var;
int nSize = <enter size here>;
VariantInit(&var);
var.vt = VT_ARRAY | VT_BSTR;
SAFEARRAY* pSA;
SAFEARRAYBOUND bounds = {nSize, 0};
pSA = SafeArrayCreate(VT_BSTR, 1, &bounds);
BSTR* bstrArray;
SafeArrayAccessData(pSA, reinterpret_cast<void**>(&bstrArray));
for (int i = 0; i < nSize; i++)
{
bstrArray[i] = <enter data here>;
}
SafeArrayUnaccessData(pSA);
var.parray = pSA;
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)
|
|
|
|
|
Perfect!! And Really thanks!
Don't reply to this if you don't have time...
You made an array of BSTR.
Howto if I'd like to make an array of VT_VARIANT's containing BSTR's?
I'm starting to become a VARIANT-friend soon.
_____________________________
...and justice for all
APe
|
|
|
|
|
Why not have a play with the code and see what you can do?
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)
|
|
|
|
|
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
|
|
|
|