|
I'm starting to get to like GDI+, but it looks there's a couple of things missing (or maybe I just can't find them)...
With the good old GDI it was easy to make a brush with one of the system colors using GetSysColor() or GetSysColorBrush().
Now I want a Gdiplus::SolidBrush() with a system color, is there an easy way to do that?
I can't find anything like GetSysColor() in GDI+
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I believe you'll need to call GetSysColor, store the result and call GetRValue/GetGValue/GetBValue on the COLORREF to build a Color.
No, I'm wrong. Color has a SetFromCOLORREF method. You can put your call to GetSysColor inside a call to that.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hi Friends,
I am using a picture control and i want that the user is able to change the bitmap of that control at runtime. The user can select any of his private bitmaps....
Thanx for the help...
|
|
|
|
|
Hi,
I need to know how to use next_permutation.The MSDN example
was not comprehensive.Can some one explain in simpler way please?
Actually , I need a code for combination.I thought of converting the output of perm into comb.
Is there any code around because I wil be writing my own code shortly as I could not find any.
Please help.
with regards,
Helena Ferguson
|
|
|
|
|
Perhaps if you explained scope and context it would be possible start to think of a solution?
next_permutation moves elements around in the (initially sorted) collection to create the permutations of its contents. Each call to next_permutation creates a new permutation of what the container holds until no more permutations can be created, and that's when it returns false.
Do you want all combinations or all permutations of one collection, or are you just looking for all possible combinations of two or more collections?
/Mike
|
|
|
|
|
Mike,
Thanx for your interest.
I need a simpler explation than MSDN using chsr or string or int.
I need all possible combinations in a set.So,I thought of getting all the permutations as a string and then eleminate those with similar elements no mater what the order is,which is what combinaton is.I hope you understood.
So,this is my need.Also please tell me about any code for combination you come across.
Bye.
|
|
|
|
|
Hey Guys
Can anyone see a problem with this code its meant to read a value out of a string in the registry and there is definately a value there. All this does though is display 3 random characters. The dword returns the right length of the string though.
I think that it might be due to the way im trying to convert unicode to asci. If anyone knows a proper way of doing it it would be a great help.
Cheers
Peter
code:--------------------------------------------------------------------------------
TCHAR sInstallDirectory[MAX_PATH];
BYTE sInstallDirectoryUNI[MAX_PATH];
DWORD dwLengthOfInstallDirectory = NULL;
HKEY hUninstallInfo;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\RCAS\\UninstallInfo", 0, KEY_ALL_ACCESS, &hUninstallInfo);
if(RegQueryValueEx(hUninstallInfo, "InstallDirectory", NULL, NULL, &sInstallDirectoryUNI[0], &dwLengthOfInstallDirectory) == ERROR_SUCCESS)
{
TCHAR sTest[10];
ultoa(dwLengthOfInstallDirectory, sTest, 10);
AfxMessageBox(sTest);
for(int i = 0; i <= dwLengthOfInstallDirectory; i++)
{
sInstallDirectory[i] = sInstallDirectoryUNI[i];
}
sInstallDirectory[i++] = NULL;
AfxMessageBox(sInstallDirectory);
}
else
{
AfxMessageBox("Read Reg Entry Failed");
CErrorHandler Error1;
DWORD dwLastError;
dwLastError = GetLastError();
Error1.ResolveError(dwLastError);
}
--------------------------------------------------------------------------------
|
|
|
|
|
Try this code...
CString GetUnstallPath(){
HKEY hKey;
DWORD dwSize;
TCHAR szInstallDirectory[_MAX_PATH];
CString sTmp;
// First off, see if the Reg key exists, if so
if (::RegOpenKey(HKEY_CURRENT_USER,
"SOFTWARE\\RCAS\\UninstallInfo",
&hKey) != ERROR_SUCCESS)
{
sTmp = "";
return sTmp; // empty string or error handling
}
// Get the Value from the Registry
if(::RegQueryValueEx(hKey,
"InstallDirectory",
NULL,
NULL,
(LPBYTE)szInstallDirectory,
&dwSize) != ERROR_SUCCESS )
{
::RegCloseKey(hKey);
sTmp = "";
return sTmp; // empty string or error handling
}
::RegCloseKey(hKey);
// Add a zero termintion
szValue[dwSize] = '\0';
sTmp.Format("%s",szInstallDirectory); // or sTmp=szInstallDirectory
return sTmp;
}
This assums that the Reg Entry is a "normal" string and does not need to be expanded.
hope this helps
|
|
|
|
|
Peter Liddle wrote:
DWORD dwLengthOfInstallDirectory = NULL;
You need to set that to the size of your buffer before calling RegQueryValueEx(). As it is now, you're telling it that you have a buffer of size 0, so it'll never return any data.
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I have almost finished a program and I want to create a setup App. I was wondering should I go with MS's Installer thingy, use Self-extracting, or a cab file type installation. I don't care which one is easier I am just wondering what you guys would suggest.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
IMHO, Window's Installer is where things are moving. It has some drawbacks. First would be that older systems would have to download the installer programm (1.4meg) if they don't have the installer installed.
Now, for a free MSI option, you can use the Microsoft Visual Studio Installer.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I was think of it but wasn't sure. Thanks for the advice.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
MHO is that, for a simple program, MSI is about 1000x too much overkill. MSI is great for stuff like Office or VC7, which have a million features. If you just have an EXE and a couple DLLs, there is zero reason to impose MSI (and its 1.5MB download) on your users.
For the CP SearchBar, which is one COM server and a couple other files, I just wrote my own simple installer that prompts for the install dir and drops the files there, and registers the DLL. I then put them in a self-extractor using WinZip. The whole procedure took maybe half a day. I can send you the installer source if you like.
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Michael Dunn wrote:
MHO is that, for a simple program, MSI is about 1000x too much overkill. MSI is great for stuff like Office or VC7, which have a million features. If you just have an EXE and a couple DLLs, there is zero reason to impose MSI (and its 1.5MB download) on your users.
Good Point
Michael Dunn wrote:
For the CP SearchBar, which is one COM server and a couple other files, I just wrote my own simple installer that prompts for the install dir and drops the files there, and registers the DLL. I then put them in a self-extractor using WinZip. The whole procedure took maybe half a day. I can send you the installer source if you like
I don't really need any code (No Offense). I was planning on creating on for specific use.
Thanks for the tips.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
|
Michael Dunn wrote:
Chill out. I was just saying I wanted to do it by myself.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
I want to right to a .txt file. I have a formated CString and I want each time it writes to do it on a new line. Can anyone help me?
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
Assuming fOut is a legal output FILE*, and sFoo is your string:
fprintf(fOut, "%s\n", (LPCSTR)sFoo);
Just one of the gazillion ways to do it.
/Mike
|
|
|
|
|
Perhaps the ::fputs(...) function?
This assumes you are using the C RTL, of course...
-=- James.
|
|
|
|
|
If you are using MFC (and it seems that you are ) the best way to go is to use CStdioFile::WriteString
I vote pro drink
|
|
|
|
|
I haven't tried it yet but I think this is what I am looking for.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
Hi,
I'm trying to work out how to set a connection timeout for winsocks without using MFC.
(With MFC you just set m_nTimeOut to the required timeout in ms before you call Connect()).
I know you can use setsockopt to set the send and receive timeouts, but is there any way to set the connection timeout?
Many thanks,
Peter Pearson
|
|
|
|
|
I know you can use setsockopt to set the send and receive timeouts, but is there any way to set the connection timeout?
This isn't really a winsock question but more a common sockets question, isn't it?
If setsockopt works, why do you want to find another way to do it? Maybe there is some obscure WSA* function to do it, but why bother?
/Mike
|
|
|
|
|
when will the function execute?
i have set a breakpoint in the first line, but program doest step into.
in fact, i want to Draw something in OnIntialUpdate() function, but MSDN said
it won't be useful, becoz when the function finished, it will send a WM_PAINT
cause the Client to be invalidated, all the drawings will disappear.
how can i finish it?
one is the other who absorbs the thoughts of others
|
|
|
|
|
just a thought
are you trying to draw in a control view? (ie, clistview, ctreeview, etc) 'cos if you are it never gets called ... use the OnUpdate() function instead
might be off the mark but its a thought
---
"every year we invent better idiot proof systems and every year they invent better idiots ... and the linux zealots still aren't being sterilized"
|
|
|
|