|
Hi,
i have a very old project without unicode support that i wanted to modernize a bit. Especially the user interface should get the new windows xp or vista control-style. But it doesn't works completly . The Dialog Controls don't wanted to switch to the new style. I tried everything i've found in the net but nothing works. Then i created a new project (mfc-application, dialog based) where i just open a about box to start some tests. The first result was:
The Button and the Icon are drawn in XP Style
Then i compared every option in the project settings and all include-files and #defines in the stdafx.h to my own project and changed one by one to find out whats wrong.
When i changed the character set from Unicode to Multi Byte i got this dialog box:
The Button and the Icon are drawn in Old Style
I really don't understand why this switch leads to this old window styles. But the bigger problem is: my own application is written completly for Multi Byte Character Set. And its a VERY Big Application. It will take days to convert it to Unicode and since there are things like text parsers included it will not be easy to be sure that everything runs fine after the conversion.
It would be nice if there is a way to get around this problem without switching to unicode.
Does someone know this problem and how to go around?
Thanks in advance.
Best Regards,
Florian
-- modified at 5:28 Friday 27th July, 2007
|
|
|
|
|
Should have used the generic text routine mappings from the start
Is it just a manifest problem?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
I'm trying to let my application run another application and give it write permission. At the moment i'm using CreateProcess, but can't figure out how to grant the process write permissions..
Tried googling alot, but can't find too many examples.. =/
Can anyone help me..?
Thanks!
|
|
|
|
|
in a bit of a rush... so sorry if this isnt much help
i believe off the top of my head that it depends on how the process is created and under which user rights it is, to allow writing and general interaction.
you want to use
CreateProcessAsUser()[^]
and either get the user account logon or run under impersonation token.
that should fix your problem
|
|
|
|
|
Thanks!
I've tried with CreateProcessAsUser, but i can't figure out how to get the token without knowing the username and password..?
|
|
|
|
|
just taken this from one of my services from awhile ago
it should be set up correct
<br />
STARTUPINFO startupInfo;<br />
PROCESS_INFORMATION pi={0};<br />
LPTSTR szCmdline=_tcsdup(L"");<br />
<br />
ZeroMemory(&startupInfo, sizeof(STARTUPINFO)); <br />
ZeroMemory(&pi, sizeof(pi));<br />
<br />
startupInfo.cb = sizeof(STARTUPINFO); <br />
startupInfo.lpReserved = NULL; <br />
startupInfo.lpDesktop = TEXT("winsta0\\default"); <br />
startupInfo.lpTitle = NULL; <br />
startupInfo.dwX = 0; <br />
startupInfo.dwY = 0; <br />
startupInfo.dwXSize = 0; <br />
startupInfo.dwYSize = 0; <br />
startupInfo.dwXCountChars = 0; <br />
startupInfo.dwYCountChars = 0; <br />
startupInfo.dwFillAttribute =0; <br />
startupInfo.dwFlags = STARTF_USESHOWWINDOW; <br />
startupInfo.wShowWindow = SW_SHOW; <br />
startupInfo.cbReserved2 = 0; <br />
startupInfo.lpReserved2 = NULL; <br />
startupInfo.hStdInput = 0; <br />
startupInfo.hStdOutput = 0; <br />
startupInfo.hStdError = 0;<br />
<br />
<br />
HANDLE hndToken;<br />
HANDLE TDuplicate;<br />
TDuplicate = TOKEN_DUPLICATE;<br />
if(DuplicateTokenEx(TDuplicate, MAXIMUM_ALLOWED,NULL,SecurityImpersonation, TokenPrimary, &hndToken)==0)<br />
return 1;<br />
if (CreateProcessAsUser(<br />
hndToken,<br />
szCmdline,
NULL,
NULL,
NULL,
FALSE,
NULL,
NULL, <br />
NULL, <br />
&startupInfo, <br />
&pi ) != 0) <br />
{ <br />
WaitForSingleObject(pi.hProcess, INFINITE); <br />
<br />
<br />
CloseHandle (pi.hThread); <br />
CloseHandle (pi.hProcess); <br />
<br />
} <br />
else
{ <br />
Beep(700,100);<br />
return FALSE; <br />
} <br />
<br />
return 0;<br />
}
Modified:
p.s if anyone can see anything stupid in there let me know please
its from about a year ago and is in my library and i havent checked it before posting as its time for lunch
|
|
|
|
|
I have developed a directshow filter . My filter connects the
upstream filter successfully . when I play my filter graph
I got the following error
cannot allocate memory because no size has been set
(return code 0x8004022)
RajeshGupta
|
|
|
|
|
code?
[Insert Witty Sig Here]
|
|
|
|
|
this is my code
//----------------------------------------------------------------
HRESULT CNetRecievePin::DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *pRequest)
{
HRESULT hr;
CAutoLock cAutoLock(m_pFilter->pStateLock());
CheckPointer(pAlloc, E_POINTER);
CheckPointer(pRequest, E_POINTER);
VIDEOINFOHEADER *pvi = (VIDEOINFOHEADER*) m_mt.Format();
//Ensure a minimum number of buffers
if (pRequest->cBuffers == 0)
{
pRequest->cBuffers =2;
}
pRequest->cbBuffer = pvi->bmiHeader.biSizeImage;
ALLOCATOR_PROPERTIES Actual;
hr = pAlloc->SetProperties(pRequest, &Actual);
if (FAILED(hr))
{
return E_FAIL;
}
//Is this allocator unsuitable?
if (Actual.cbBuffer < pRequest->cbBuffer)
{
return E_FAIL;
}
return S_OK;
}
//----------------------------------------------------------------------
RajeshGupta
|
|
|
|
|
how to let all contents tabs of html-help expand when the htmp-file pops up by HtmpHelp(...) function?
it can be done in html-help design or c++ code.
I did see some apps with contents tabs expended when apps' html-help pop up.
thx.
|
|
|
|
|
I have one source code of project in which our dll is used that source code is not full source code the client give us obj file instead of cpp and we fix bugs of our dll now linking error occur when i execute that program with new dll. pls help me if anybody have any idea.
Thanks in advance
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Maybe (i.e. post error messages for meaningful help) you have changed function signatures.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
No i dont change any function signature ,i just fix bugs only. the problem is that as i learn .obj is only compiled file and it is not linked with library when we execute our porgram than it link with library and gives executable file. (.exe ).but in my case it give linking error.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Shilpi Boosar wrote: the problem is that as i learn .obj is only compiled file and it is not linked with library
the .obj contains the necessary info to perform the function calls to your DLL at runtime hence, if you're stuck with original signatures (and exports) then you shouldn't experience problems. BTW Why don't you post the error message?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
i know thats y i said that i dont change any signature of API that is exported .i just fix bugs.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
OK, to summarize, all the info I got from you, are: "I fixed bugs". Hence, all that I can deduce is that your executable works fine, congratulations!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
No mam that is the main problem that program is not working .
any ways thanks
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
what linker error are u gettin. please post the error so that we can get more clarity over your problem. CPallini Has asked to two times to post the error!
We are eager to help but you are not letting us
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
Shilpi Boosar wrote: No mam that is the main problem that program is not working
Oh, that means you're unlucky, kid.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I am writing the following code for creating the XML file.
HRESULT hr;
IXMLDOMDocumentPtr pXMLDoc = NULL;
CoInitialize(NULL);
hr=pXMLDoc.CreateInstance("msxml2.domdocument");
IXMLDOMNodePtr pRootNode= NULL;
IXMLDOMNodePtr pRecNode= NULL;
IXMLDOMNodePtr pRecNode1= NULL;
IXMLDOMElementPtr pElement=NULL;
_variant_t varNodeType((short)MSXML2::NODE_ELEMENT);
hr= pXMLDoc->createNode(varNodeType,
_T("RTCS"), _T("Remote Target Control System"),&pRootNode);
hr=pXMLDoc->createElement(_T("Connection"),&pElement);
IXMLDOMAttributePtr pRecIdAttr = NULL;
IXMLDOMNamedNodeMapPtr pattributeMap;
hr=pXMLDoc->createAttribute(_T("connect"),&pRecIdAttr);
hr=pRecIdAttr->put_nodeTypedValue(_variant_t(_T("connect_val")));
hr=pElement->get_attributes(&pattributeMap);
hr=pattributeMap->setNamedItem(pRecIdAttr,&pRecNode);
hr=pXMLDoc->appendChild(pRootNode,&pRecNode);
but i am not able to see the child node created in the xml file.Only root node is created:
The xml file i want to create is:
?xml version="1.0"?>
<rtcs name="Remote Target Control System">
<Connection connect= "connectval" ipaddress = "ip_addresss" Port = "port_number"/>
<Logging Directory="path" Level="level" ComPort="port_number" Maxsize="max_size"/>
<Video BitRate="bitrate" InputType="input_type" Preview="preview" FrameDrop="frame_drop" Dumping ="dump"/>
<IR directory_path="dir_path"/>
</rtcs
Regards,
|
|
|
|
|
If you are CREATING an entire XML file, why not do it using string classes instead of all that messy COM stuff ?
Why on earth do you bother to grab the HRESULT returned, if you never check it ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi
In my VC 6.0 programme I used Sqlserver with ODBC connection.
Connection and the retrieving data from the Server was ok.
But initially when I executing it ask for the Server login and password for the Sql Server.
Can any tell me about giving the Sql Server login id and password through Coding itself.
(In programme I used CDatabase, CRecordset)
Awaiting for your suggestion of this.
Regards
shakumar
shakumar
|
|
|
|
|
Here below is the code snippet to directly give uid and pwd
#define CONNECT_STRING _T("DSN=xxxxxxxxxxx;UID=cccccccc; PWD=ccccccccccc")
m_pDBConn = new CDatabase();
BOOL w_bIsOpen = FALSE;
if(m_pDBConn)
{
try
{
//opens a connection to the data source
w_bIsOpen = m_pDBConn->OpenEx(CONNECT_STRING);
.......................
But with this way, you can not change your database password, with out rebuilding the application. The best way is to add two fields (uid and pwd) in the registry and read it from there. With this you can change uid and pwd with out rebuilding the application. But you need to encrypt the uid and password in the system registry, else any one can hack it.
|
|
|
|
|
Its working properly and very thanks ful for this
shakumar
|
|
|
|
|
Hello everyone,
If I want to convert LPCTSTR and HRESULT to standard C/C++ data type (like char*, int, long, etc.), I am wondering what standard data types should I convert to be safe and do not lose and data precise?
thanks in advance,
George
|
|
|
|