|
Finally I found out the solution. I didn't associate the Menu to Main Frame. Instead I did to one of the views. Surprisingly it let me pick a view.
|
|
|
|
|
Hi.
One of the applications I've coded refuse to work correctly on WinXP (but was working fine for months under Windows 2000). I wonder if someone else notice this kind of problem.
More specificaly, I'm using anonymous pipes to make the two parts of my application communicate, but unfortunately the created process never get the handle of the pipes the main process creates. It results in the fact the the child process get the standard STDIN/OUT/ERR handles when it does GetStdHandle().
[Note: I'm not using CreateProcess, but CreateProcessWithLogonW. I can send a part of the code if it helps.]
|
|
|
|
|
Any body here Know where I can find some documentation about that?
Best Reagrds....
Tomorrow is Friday!!!
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
The foundational paper by Charles Simonyi.
It is my impression that Hungarian notation has fallen into some discredit during the last years, mainly because it promotes a very loose way of type checking. Languages more modern than C (like C++) have stricter type checking systems that render this kind of nmenomics redundant in the best case (or false in the worst, if you changed the type of a variable and forgot to rename it).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Gracias Joaquin,
Muy util, tu información....
Best Regards!!!!
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
|
Thanks, it's very funny!!!
Estaba interesado en esa notación porque un compañero de trabajo no la conoce.
I was interested in that notation because a co-worker don't know it...
Joaquín,
Thanks again
Muchas Gracias....
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I've created an ActiveX control with VC++ 6.0, and i try to call CoInitializeEx() at the beginning of a worker thread, but it doesnt recognize the API, and all I get is an undeclared identifier error for that
and COINIT_MULTITHREADED;
I linked to "ole32.lib" and i threw in in for kicks at the top of the .cpp and in a separate case, the .h
I AM LIKE ----------------| |-------------------
THIS CLOSE
to getting this crap... i dont have a clue... i've running the project on a different machine as well and i get the same errors. i've tried to throw in just about every other library as well... am i missing a library? Could someone show me what libraries they link to in a project that works? Any suggestions would be so helpful...
Thanks,
~Tim
SHABBA!!
|
|
|
|
|
Add this before the standard headers are included in your stdafx.h file
#define _WIN32_WINNT 0x0400
Chen Venkataraman
|
|
|
|
|
Let's all say it together kids:
"Chen Venkataraman is THE MAN"
thanks a whole whole whole whole whole bunch.
*BIG SIGH OF RELIEF*
~Tim
SHABBA!!
|
|
|
|
|
BTW, you could also do the same with Project Settings -> C/C++ -> Preprocessor & add this _WIN32_WINNT=0x0400 to the defines
Chen Venkataraman
|
|
|
|
|
Have anyone come across any function that can format a number with thousand seperators?
Thanks
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
|
Hi,
I saw that the code below didn't work in order to get a HBITMAP in an extension DLL:
// Set a bitmap for a button
m_pbSample.SetBitmap(LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_SAMPLE)));
I found another method for that and it works:
CBitmap bmSample;
VERIFY(bmSample.LoadBitmap(IDB_SAMPLE));
// Set a bitmap for a button
m_pbSample.SetBitmap((HBITMAP)bmSample.Detach());
Now, I would like to do the same for an icon in extension DLL. Assume that I have an icon in the DLL resource named IDC_SAMPLE.
How can I get an HICON for that? I need this to change the icon in the title bar of a dialog.
HICON hiconSample;
// ???
SetIcon(hiconSample, FALSE);
SetIcon(hiconSample, TRUE);
Thanks....
|
|
|
|
|
Does anyone know how to change the screensaver to another one.
I know I can change the HKCU\control panel\desktop\scrnsave.exe value, but then the user have to reboot.
Is there an API to do it?
I can set some properties on the screensaver with SystemParametersInfo(), but I cant find a way to tell the system that I have changed the scrnsave.exe registry value...
Any ideas?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
When running my VC++5/MFC app under XP, most dialog fonts look bad. Fonts in property pages & common dialogs look great (except for added controls in FileOpen). Fonts in menus and messageboxes look great, too. Adding a manifest file makes no difference to the fonts, but verything else turns cool<g>.
From scouring MSDN/KB it seems the trick is to specify dialog resources to have style DS_SHELLFONT and use the "MS Shell Dlg" font (rather than "MS Sans Serif").
However ... in VC++5, DS_SHELLFONT isn't defined and I can't specify "MS Shell Dlg" (because its not availalable on my development system?)
Is my understanding of the issues / solution correct ?
Is there a way to achieve what I need with VC++5, or must I upgrade to VC++6, or what ?
Many thanks
Steve Kearon
|
|
|
|
|
You need to do three things:- Change the DIALOG resource to DIALOGEX (just add the "EX" in a text editor).
- Change "MS Sans Serif" to "MS Shell Dlg". (MS Shell Dlg isn't a physical font, you won't find it on any system. It's a special name the OS recognizes.)
- Add DS_SHELLFONT, which is equal to DS_SETFONT | DS_FIXEDSYS
--Mike--
http://home.inreach.com/mdunn/
"Not our fault we are intellectually superior to the rest of the office." -- Paul Watson in the Lounge, 12/12/2001
Sonork - 100.10414 AcidHelm
|
|
|
|
|
i'd like to convert between a char and int!
from CString.GetAt(int) i get a char ( or unsigned short) how do i change this to an integer (to get the ASCI code)???????
Please help
|
|
|
|
|
int iInt = 127;
char cChar = 99;
char cCast = static_cast<char>(iInt);
int iCast = static_cast<int>(cChar);
Normski. - Professional Windows Programmer
|
|
|
|
|
HTML parser ate some stuff:
int iInt = 127;
char cChar = 99;
char cCast = static_cast <char>(iInt);
int iCast = static_cast <int>(cChar);
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Cheers Tim,
I don't much web stuff.
Normski. - Professional Windows Programmer
|
|
|
|
|
Cheers Tim,
I don't do much web stuff.
Normski. - Professional Windows Programmer
|
|
|
|
|
Does anyone know how to get the system idle time???
Thanx in advance
Bin
|
|
|
|
|
Why do you care about the system idle time?
I have to think you're really trying to do something else, like calculate uptime or something. What are you trying to do?
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|
Now for the c++ dll that will object pool db connection and return a disconnected recordset, I have been attempting to learn on my own with a lot of samples.
The project works fine I believe. Let´s say it runs and I can watch its specifics in the MMC (View Status, Components)
I have run this with and without the IObjectControl Method. I know I have not coded it 100%.
The sample that I am using did not include the events Activate, Deactivate, CanBePooled, it would still object pool (allow me to create instances), but I read:
It is not mandatory for a COM object to implement this interface in order to be pooled. The exception to this rule is if the pooled object also happens to be transactional, in which case the CanBePooled method of the interface is used to determine the state of the resources it holds. If a COM object does not implement IObjectControl, instances of it will be created until the maximum pool size is reached, as each instance is assumed to be poolable.
To see the related changes, you must open the project (Activate, Deactivate, CanBePooled Methods.)
I know that I am not handling the activate, deactivate, canbepooled correctly could you take a look at this part.
I am not evening deactivating the existing code handled it in its own way.
HERE IS A SAMPLE OF WHAT I AM TALKING ABOUT Alan Gordon was the original author of this)
// Book.cpp : Implementation of CBook
#include "stdafx.h"
#include "Articleproject.h"
#include "Book.h"
const E_CONFIGURATION=MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200+108);
const E_CONFLICTS_FOUND=MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200+109);
const int conTitleFieldLength=80;
#undef EOF
/////////////////////////////////////////////////////////////////////////////
// CBook
HRESULT CBook::Activate()
{
HRESULT hr = GetObjectContext(&m_spObjectContext);
if (SUCCEEDED(hr))
return S_OK;
return hr;
}
BOOL CBook::CanBePooled()
{
return TRUE;
}
void CBook::Deactivate()
{
m_spObjectContext.Release();
}
STDMETHODIMP CBook::InterfaceSupportsErrorInfo(REFIID riid)
{
static const IID* arr[] =
{
&IID_IBook
};
for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
{
if (::ATL::InlineIsEqualGUID(*arr,riid)) // pjs added
return S_OK;
}
return S_FALSE;
}
STDMETHODIMP CBook::RetrieveByID(BSTR id, _Recordset **rs)
{
_bstr_t strDescription;
HRESULT hRetval;
_ConnectionPtr pConn;
_RecordsetPtr pRS;
IContextState *pContextState=NULL;
if (0==mConnectionString.length())
{
hRetval=E_CONFIGURATION;
strDescription=L"You must configure a connection string";
goto exit_cleanup;
}
hRetval=CoGetObjectContext(IID_IContextState,(void **)&pContextState);
if (SUCCEEDED(hRetval))
{
// NEW WAY PJS 12/8/2001 TO PASS IN SQL STMT AND CREATE AN DISCONN RECORDSET
_bstr_t sql(id);
try
{
// Create and Open the Connection PJS
pConn.CreateInstance( __uuidof(Connection));
pConn->Open(mConnectionString, "", "",-1);
// Create and Open the Recordset PJS
pRS.CreateInstance( __uuidof(Recordset));
pRS->CursorLocation=adUseClient;
pRS->Open(sql,pConn.GetInterfacePtr(),adOpenStatic,adLockBatchOptimistic,-1);
pRS->AddRef();
*rs=pRS;
pRS->PutRefActiveConnection(NULL);
}
catch ( _com_error err)
{
strDescription=err.Description();
hRetval=err.Error();
}
}
else
{
_com_error err(hRetval);
strDescription=
L"Your component may not be" \
L" configured";
}
// Exit and cleanup code
exit_cleanup:
if (NULL != pContextState)
{
if (SUCCEEDED(hRetval))
pContextState->SetMyTransactionVote(TxCommit);
else
pContextState->SetMyTransactionVote(TxAbort);
pContextState->SetDeactivateOnReturn(VARIANT_TRUE);
pContextState->Release();
}
if (NULL != pConn)
{
if (adStateOpen==pConn->GetState())
pConn->Close();
pConn=NULL;
}
if (SUCCEEDED(hRetval))
return hRetval;
else
return Error((LPOLESTR)strDescription,IID_IBook,hRetval);
}
Other changes:
I changed compile info in comsvcs.h
I forced compile to be for win2k. I was getting weird _GetObjectContext errors.
I found on Google an article that told be to force to 2K. What are your thoughts ???
After implementing I was able LINK just fine. I read there is some issue with how win2k platform is identified. ??
//#if (_WIN32_WINNT >= 0x0500)
#define GetObjectContext(ppIOC) (CoGetObjectContext(IID_IObjectContext, (void **) (ppIOC)) == S_OK ? S_OK : CONTEXT_E_NOCONTEXT)
//#else
//extern HRESULT __cdecl GetObjectContext (IObjectContext** ppInstanceContext);
//#endif
3. Provider = MSDAORA.1;Password=wwww;User ID=xxxxx;Data Source=DEV2;Persist Security Info = True;OLE DB SERVICES = -2;
I put a value of OLE DB SERVICES = -2 at the end of my OLEDB Connect string.
Is this the best number to use. I want to just ensure that we are object pooling not resource pooling. I did not wish to use 0 "no services". What are your thoughts?
|
|
|
|