|
You can't - you need to make a new one. Use GDI+ for a pen that allows parameter changes.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I suppose you have a CPen object, pen.
Use pen.GetObject() to retrieve a LOGPEN structure.
Modify the parameters you need, then create another CPen to replce the old one. You may also reuse the same object: pen.DeleteObject(); pen.CreatePenIndirect().
If the pen you want to modify is selected into a CDC, use this to get a pointer to a temporary CPen:
CPen* pPen = (CPen*)dc.SelectStockObject(NULL_PEN);
Paolo.
|
|
|
|
|
Hello,
I'm having trouble using the SQLGetPrivateProfileString() method. I have an ODBC Sybase database configured as "123" in the User Data Sources section. This corresponds in the registry to:
\HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\123
I want to retrieve the string value (REG_SZ) "DatabaseSwitches" which just
contains "netbios". I called SQLGetPrivateProfileString() as follows:
int numread =
SQLGetPrivateProfileString(
"123",
"DatabaseSwitches",
sdefault,
buffer,
retbuf,
"ODBC.INI");
and it does not return anything. Any ideas what I'm doing wrong?
Thanks!
Derek
|
|
|
|
|
Try with this.
int numread =
SQLGetPrivateProfileString(
"123",
"DatabaseSwitches",
sdefault,
buffer,
sizeof(buffer),
lpzsFilename); //lpzsFilename must be LPCSTR
I saw that you try to pass the last parameter when this parameter is type Output.
What value has numread after to execute the function?
Best Regards.
Carlos Antollini.
|
|
|
|
|
I get easily confused with all of MS's macros - LPCSTR, etc. , so here's what I tried:
char *lpszFilename = new char[250];
ZeroMemory(lpszFilename, sizeof(lpszFilename));
numread = -1;
numread =
SQLGetPrivateProfileString(
"123",
"DatabaseSwitches",
sdefault,
buffer,
sizeof(buffer),
lpszFilename); //lpzsFilename must be LPCSTR???
delete [] lpszFilename;
The only thing that changed was numread=0.
|
|
|
|
|
I get easily confused with all of MS's macros - LPCSTR, etc.
Don't worry about that.
Also You need to assign memory to variable buffer because in the buffer variable you will reciebe the string.
Also you need to copy de path of ODBC.ini in lpszFilename.
strcpy(lpszFilename, "ODBC.INI");
if all is OK you the function will return the number of chars in numread and the string in buffer, if this don't work, try to copy in lpszFilename the complete path of odbc.ini.
Carlos Antollini.
|
|
|
|
|
Good news! I figured out what was happening. I was asking for a value that was not in the odbc.ini *FILE* in \winnt. I thought that SQLGetPrivateProfileString() got values from the registry based on the MSDN help:
A configuration mode indicates where the Odbc.ini entry listing DSN values is in the system information. If the DSN is a User DSN (the state variable is USERDSN_ONLY), the function writes to the Odbc.ini entry in HKEY_CURRENT_USER. If the DSN is a System DSN (SYSTEMDSN_ONLY), the function writes to the Odbc.ini entry in HKEY_LOCAL_MACHINE. If the state variable is BOTHDSN, HKEY_CURRENT_USER is tried, and if it fails, HKEY_LOCAL_MACHINE is used.
What am I missing here?!
|
|
|
|
|
Okay - I really have it working now. I'm not sure it wasn't before, but here's what I did:
CString sDsn = "123";
CString sEntry = "DatabaseSwitches";
CString sDefault = "netbios";
CString sFilename = "ODBC.INI";
char pszRetBuffer[MAX_FNAME_LEN];
ZeroMemory(pszRetBuffer, sizeof(pszRetBuffer));
numread = SQLGetPrivateProfileString(
(LPCSTR)sDsn,
(LPCSTR)sEntry,
(LPCSTR)sdefault,
pszRetBuffer,
sizeof(pszRetBuffer),
(LPCSTR)sFilename);
Thanks again for all the help!
Derek
|
|
|
|
|
I get easily confused with all of MS's macros - LPCSTR, etc. , so here's what I tried:
char *lpszFilename = new char[250];
ZeroMemory(lpszFilename, sizeof(lpszFilename));
numread = -1;
numread =
SQLGetPrivateProfileString(
"123",
"DatabaseSwitches",
sdefault,
buffer,
sizeof(buffer),
lpszFilename); //lpzsFilename must be LPCSTR???
delete [] lpszFilename;
The only thing that changed was numread=0. Can you get this to work on your system?
Thanks,
Derek
|
|
|
|
|
I guess that there must be many ways to do this, but could you guys give me any ideas, links, etc.? Also, what is the proper term for this, I've read somewhere that the expression "timebomb" is not really appreciated in the industry...
Thanks!
|
|
|
|
|
Lots of different ways, but I'd make one very serious suggestion - if you want to release a crippled version, I'd actually strip out all the code you don't want to give away. Because if you put something like this at the top of your code:
m_bFullVersion = CheckIfFullVersion();
then a cracker has one point to modify and your pants are down. Better not to distribute at all any code you want people to pay for IMHO.
I'd suggest keeping track of the date in multiple ways, so if one is tampered with, you find the details elsewhere and shut down ( your trial has expried, please go to www.payme.com to register ). If one of those ways is obvious (.ini or registry ), people trying to tamper will start there and it will all be over for them.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hi,
problem:
When I launch MSDN Library (separately or by pressing F1 in Visual C++) it immediately sucks down every available resource and just sits. I can see the hh.exe (MSDN) process in the task list, but it hangs. No windows pop up or anything. I think, there is a problem with the HTML Help system.
I have tried to uninstall and re-install MSDN, IE5.5 and Win2000 but it didn't help. Does anyone knows what to do?
tnks,
Phil
system:
Win2000SP2, VS6 enterpr. SP5, IE5.5SP1
|
|
|
|
|
I had this happen a few days back, thought I was using XP... I ended up reinstalling -- using Win2K Pro now, and evrithing seems fine.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Same here. One time after a crash this behavior started and my only remedy was to reinstall MSDN. After which everything worked fine (I did try recreating my project dynamic files, etc).
--Mark Terrano
www.ensemblestudios.com
(Creators of the Age of Empires series)
|
|
|
|
|
I'm writing an extension to windows shell. It was placed to the "My Computer" and have created some subfolders (my hierarchy). Explorer is showing all of them and I have no problem with it.
But when I'm opening notepad and try to open a file from my extension (or just browse through it) - there is no my extension at all in the CFileDialog window.
How can I implement such feature? I've started to think about DDK, but I don't think that My Documents folder was created via DDK, but it is accessible from the standart save/open file dialogs. How can I do the same?
With the best regards, Vitaly.
|
|
|
|
|
There is a KB article describing what you have to do to get your NSE to show up in the common file dialog.
Dont have a link to it where i am, but try searching for it.
(you will not get that many hits if you search on "namespace extension")
The bad news is that i will only work on win 2000 and newer systems.
(without some serious "hacking" with yor NSE)
|
|
|
|
|
Hello, I have found a class that has allowed me to make a syntax highligthing editor in a very easy way, it works very fine excepting the fact that it has not tha capability of undo what has been done.
I would like to know if there is any way of keeping the undo buffer unaltered when the RichEditCtrl is being "colorized".
Or how should I do in order to make my own undo buffer.
As always thank you very much.
|
|
|
|
|
Ok, I tried to place a Rich Edit Ctrl on a Dialog in the Resource editor for my WTL app. When I run the app the dialog can no longer be created. I had to add an initialization for the IP Address control to get that to work. Is there something I need to do to get Rich Edit controls to work in a WTL app? Please Help Me
|
|
|
|
|
Yes, you need to load the rtf dll to use...
So in your tWinMain()...
HINSTANCE hInstRich =
::LoadLibrary(CRichEditCtrl::GetLibraryName());
...
int nRet = Run(lpstrCmdLine, nCmdShow);
...
::FreeLibrary(hInstRich);
Use the define in stdafx.h to detemine rtf verion...
#define _RICHEDIT_VER 0x0200
Have a look at my website below. Lots of nice WTL samples
there.
Bjarke Viksoe
My code at: www.viksoe.dk/code
|
|
|
|
|
Thanks, that's a nice website BTW.
|
|
|
|
|
I need to read a database which is connected with ado method. I use a databinding method with the macro BEGIN_ADO_BINDING...
So in the first column i have some dates. I need to see if a date, given by the user, is in the table, if it's the case i do sthg, but if not i need to find at the same time the dates which frame the user's date(Previousdate
|
|
|
|
|
How do I create an Editor that has the functionality like Netscape commmunicator
|
|
|
|
|
Hello
BACKGROUND :
There is an exe called "SendMail.exe" developed by me. SendMail.exe is a
command line application that sends mail to the e-mail specified.
SendMail.exe does some processing before sending the mail. This processing
will fail if more than one instance of my application tries to do the same.
Hence I create a mutex (during installation of my application) so that only
one instance is doing the processing.
So the sequence of operation in SendMail.exe will be :
1) Wait for the mutex
2) Obtain the mutex, do the processing
3) Release the mutex
REQUIREMENT :
Suppose 4 SendMail.exes are launched. I want these exes to do the
processing in the SAME ORDER as they were launched. For e.g. the processing
should be done in the following sequence :
1) SendMail1.exe
2) SendMail2.exe
3) SendMail3.exe
4) SendMail4.exe
PROBLEM :
Using a mutex, this sequencing is NOT possible. Mutex usage only ensures
that all the applications waiting for it will get it but the ORDER in which
they will get is not known.
Could anyone tell me how to achieve my requirement. Any idea is welcome.
Thanking you in advance.
Have a nice day.
With best regards
Rama
Siemens
|
|
|
|
|
You could use the regisry to store a kind of queue. when sendmail.exe recieves the mutex, check to see if it is next in the queue, if it is then do processing and remove queue entry, if it isn't then release the mutex so another task gets it.
it does seem a particularly wierd thing to want to do though.
|
|
|
|
|
Can't you just acquire and release the mutex in the process that launches sendmail.exe?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|