|
You will probably need to use the system() or _popen() call to get what you need. Take a look at the MSDN references[^] for more information.
|
|
|
|
|
|
Hi all..
I am facing a problem with the font selection in menu..
here the color of font is not changing once selected.. but the type and size everything is changing as per selection..
Iam using CreateFontIndirect
and below is my code for OnFont()
CWnd *pwnd = CWnd::GetFocus();;
int wID = pwnd->GetDlgCtrlID();
LOGFONT If;
CFont *font = new CFont();
if(wID==IDC_SAFE)
{
CFontDialog FontDlg(&If);
if(FontDlg.DoModal() == IDOK)
{
font->CreateFontIndirect(&If);
m_edittext.SetFont(font);
}
}
plz help me to solve it
|
|
|
|
|
I think you need to set the text colour independently of the font, with the value from the CFontDialog.GetColor() method.
|
|
|
|
|
thanku Richard...
n sorry for the late reply..
i tried implementing ur sggestion but dat too is not working....
|
|
|
|
|
sonualex wrote: i tried implementing ur sggestion but dat too is not working....
Sorry, but I cannot guess what is not working, you will need to explain what you have done and what results you are getting.
|
|
|
|
|
I am trying to create a ccomboboxex using createwindow function.but I get the old combobox look(3d gray).
How can I get the XP appearance combobox? Any idea? thank you.
|
|
|
|
|
It happens not only for controls you create but also for all windows.
There are several ways you can achieve this. the easiest is to include a manifest file to enable visual styles.
Manifest should have following name: appname.manifest. For example SomeApp.exe.manifest.
Include manifest file in the same directory as your executable module. That is it.
To avoid copying or including additional file in you distribution package, you can include manifest file as a resource in your project but this is a little bit more complicated.
JohnCz
MS C++ MVP
|
|
|
|
|
thank you for the anwser.
|
|
|
|
|
As JohnCz said, use a manifest file. The manifest needs to specify using the Common Control 6.0. Here's a sample (change the app name as you see fit):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.1" processorArchitecture="X86" name="KRM.Undecorate" type="win32" />
<description>Undecorate a C++ name.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" />
</dependentAssembly>
</dependency>
</assembly>
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
thank you for the anwser,but your way can't solve my question.
|
|
|
|
|
Strange. It is working for me...
Did you follow all steps?
Perhaps if you explained all steps you have taken it would explain why it does not work.
What is the name of your application?
What is the name of your manifest file.
Did you copy manifest text from Karl’s post?
Directory where did placed manifest file.
JohnCz
MS C++ MVP
|
|
|
|
|
Hi,
Given a Mapped Drive i.e.'F:\' Is itpossible to recover the Server Name and Path .
Regards,
Bram van Kampen
|
|
|
|
|
I thought the information was available in the 'Netshare' API's - these days its likely to be available through WMI as well - if only a bit more convoluted to access
'g'
|
|
|
|
|
|
You also can read the RemotePath key in HKEY_CURRENT_USER\Network\DRIVE_LETTER to get the mapping information
|
|
|
|
|
Thanks for that info - filed away for future use
'G'/Remote/via Blackberry
|
|
|
|
|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) Thanks.
I used this to write an "API" as follows:-
<br />
SGAPI BOOL GetUNCA(LPCSTR DriveSpec, LPSTR pstrResult,LPDWORD pcbSize){<br />
if((DriveSpec==NULL)||(pstrResult==NULL)||(pcbSize==NULL)){<br />
SetLastError(ERROR_INVALID_PARAMETER);<br />
return FALSE;<br />
}<br />
if(strlen(DriveSpec)!=3){<br />
SetLastError(ERROR_BAD_FORMAT);<br />
return FALSE;<br />
}<br />
if((DriveSpec[1]!=':')||(DriveSpec[2]!='\\')){<br />
SetLastError(ERROR_BAD_FORMAT);<br />
return FALSE;<br />
}<br />
<br />
char ch=toupper(DriveSpec[0]);<br />
if((ch<'A')||(ch>'Z')){<br />
SetLastError(ERROR_BAD_FORMAT);<br />
return FALSE;<br />
}<br />
CString SubKey="Network\\";<br />
SubKey+=ch;<br />
<br />
HKEY hkResult;<br />
if(RegOpenKeyExA(HKEY_CURRENT_USER,SubKey,NULL,NULL,&hkResult)!=ERROR_SUCCESS){<br />
<br />
SetLastError(ERROR_INVALID_CATEGORY);<br />
return FALSE;<br />
}<br />
<br />
DWORD Type=REG_SZ;<br />
DWORD dwRes=RegQueryValueExA(hkResult,"RemotePath",NULL,&Type,(LPBYTE)pstrResult,pcbSize);<br />
RegCloseKey(hkResult);<br />
<br />
if(dwRes==ERROR_SUCCESS)return TRUE;<br />
<br />
SetLastError(ERROR_INVALID_CATEGORY);<br />
<br />
return FALSE;<br />
}<br />
One of the Things is: How do those Subkeys Translate in Foreign Languages... ???
Thanks A lot for the Info
Bram van Kampen
|
|
|
|
|
hmmm!
GetUNC is a Commandline Utility. Maybe as a Last Resort.
Thanks for your comment though.
Regards,
Bram van Kampen
|
|
|
|
|
the CNetservice I showed from CodeGuru is NOT a command line utility - why would I have shown you something sooo useless, hmmmm ???
If you look for CNetService by Jay Wheeler, and get the download, you'll see GetUNC() uses APU WNetGetUniversalName
I was thinking one of is crazy, glad its not me, ok, for once
'g'
|
|
|
|
|
Hi,
Garth J Lancaster wrote: the CNetservice I showed from CodeGuru is NOT a command line utility - why would I have shown you something sooo useless, hmmmm ??
Well, that's what the link appeared to be pointed to. I asked myself the same question.
Garth J Lancaster wrote: If you look for CNetService by Jay Wheeler, and get the download, you'll see GetUNC() uses APU WNetGetUniversalName
I was thinking one of is crazy, glad its not me, ok, for once
Well maybe the gremlins...
Found that site, its very usefull.
Thanks.
Bram van Kampen
|
|
|
|
|
|
Bingo!
Just the Ticket. Thanks.
As a Side Line, The MS Windows API is growing that wide that even googeling, or MSDN becomes difficult, if you don't remember the name of an API in the first place. Many of the 10,000 or so Microsoft engineers seem to be having the same problem. They have another weapon though, access to the windows code, and it occurs to me that if they cannot find quikly what they need, that they just introduce another API to add to the pile.
In the mean time I wrote:
<br />
SGAPI BOOL GetUNC(LPCSTR DriveSpec, LPSTR pstrResult,LPDWORD pcbSize)<br />
based on the previous replies. That was not difficult, but WNetGetUniversalName() is more universal, and less likely to break in future versions.
Thanks,
Bram van Kampen
|
|
|
|
|
rats - he beat me to it - see my prev response - lest you got there in the end - have fun
'g'
|
|
|
|
|
Hi,
BTW.
That Reg Entry. If you delete that, does that 'Undo' Drive mapping. I know of no way to 'Unmap' a drive in XP. Does not bother me much, I never realy use this 'Drive Mapping Feature' I personally think that it is a leftover from the DOS days, (maybe you don't remember those)
Those where the days that God was with us in Paradise, and all of us had Floppies. Lo and Behold, Someone invented the CD. Everybody took a step back and admired in awe, and all those guru's, came up with further int14's and complicated code, to assign those horrid things a drive letter, using a device called MSCDEX, etc. Afterall, DOS could only deal with Block devices if they had a Drive Letter, so a drive letter it got.
Then some Nasty bugger invented Networking! Not to worry, MS had already a Mechanism to map Drives... Just another Interrupt, And, Presto, we had 'Share', with, guess it... A Drive Letter!
Me thinks, No real need for all that crap. UNC Names are about as good as it gets.
The problem occurs, where XP supports this anachronism. Some of my customers use Network Shares assigned to a Mapped Drive. Over Time, Things break, and I have to unravel the mess in a Fix, but, Idealy trap it during the Setup.
Thanks for your Contribution.
Regards
Bram van Kampen
|
|
|
|