|
Thanks for response. Question: I'm trying to set the ES_PASSWORD style of an edit control..would this be the right way to go about it:
DWORD style = m_wndPassword.GetStyle ();
style |= ES_PASSWORD;
::SetWindowLong (m_wndPassword.GetSafeHwnd (), GWL_STYLE, style); When I run this the password style doesn't appear to be set at all. Any ideas? Thanks again.
- Aaron
|
|
|
|
|
Aaron,
If your using MFC then it's easier to use the ModifyStyle method:
m_wndPassword.ModifyStyle(0, 1, ES_PASSWORD);
Hope this helps,
Andy
|
|
|
|
|
Perhaps you meant this link?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thanks David
must have had a mad cut'n'paste moment.
Cheers,
Andy
|
|
|
|
|
Just tried that Andy, but it wouldn't work either. From the other replies it's looking like I'll need to recreate the control to do this. Thanks for the help though.
- Aaron
|
|
|
|
|
AFAIK some styles could not be changed at runtime: password/left/right/center.
You have to recreate control.
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|
|
grigsoft wrote:
AFAIK some styles could not be changed at runtime...
ES_READONLY is another of those styles. But you can use EM_SETREADONLY instead!
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
monrobot13 wrote:
Any ideas?
Is the control single or multi-line?
It might not even be possible. Read here.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
It's single line.
Looking at the replies above am I going to have to recreate the control since it's looking like some styles can't be changed at runtime? I tried ModifyStyle and it didn't work either. Thanks for the help.
- Aaron
|
|
|
|
|
I got it working, but not by modifying the sytle. I used SetPasswordChar and that seems to have changed the style for me. Not sure if that the best way to do it, but it's working. Thanks to everyone who replied for the help.
- Aaron
|
|
|
|
|
Thanks for the help on my earlier problem.. I have now undertaken rewriting the serial portion of my code to use CreateFile and the like. It's all a bit complicated though, and being new to this, I have a few questions. It starts with overlapping, and also involves WaitCommEvent and GetCommMask. I did a search on the topics and read a few articles that were found, but while they cleared a few things up, they still left me with a few questions unanswered.
First, I understand that SetCommMask allows you to screen for only a few of the events. But after calling SetCommMask to look for only what you want, how does one screen for these events and process them appropriately? I know you can use WaitCommEvent, but in that case, why would you even need GetCommMask? I also need to use overlapping for this program, but I'm not sure how to implement it or even what it actually is (do I need to use the overlapped structure at all?).
I was able to find this piece of example code on MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/monitoring_communications_events.asp
I do not fully understand how it operates, though.
Also, this article was very helpful, to a point: http://www.codeproject.com/system/serial_com.asp
Where I got lost was the huge block of code where he uses the OVERLAPPED structure and the Threadfn function, after which he writes "If you understood the above code , you will understand the whole of this article and the source code provided." Gulp.
As always, the help is very much appreciated.
|
|
|
|
|
From this link: Configuring a communications resource:
#include <windows.h><br />
<br />
int main(int argc, char *argv[])<br />
{<br />
DCB dcb;<br />
HANDLE hCom;<br />
BOOL fSuccess;<br />
char *pcCommPort = "COM2";<br />
<br />
hCom = CreateFile( pcCommPort,<br />
GENERIC_READ | GENERIC_WRITE,<br />
0,
NULL,
OPEN_EXISTING,
0,
NULL
);
pcCommPort is declared as a pointer to a character, which is assigned "COM2". How does this make sense? A char cannot be more than one character in length, right? Upon testing, trying to do *pcCommPort = "COM3" later in the program does indeed yield "error C2440: '=' : cannot convert from 'char [5]' to 'char'" which actually makes sense. So why is that same assignment statement allowed upon declaration?
Also, if at some point, I need to change the COM port to say, COM3, how would I accomplish that? *pcCommPort = "COM3" did not work, as I mentioned.
Thanks in advance.
|
|
|
|
|
"COM2" is a constant null terminated string allocated somewhere by the compiler. It's reasonable to set a char * to point to its first character. But really it should be a const char * since the value of the string should not be changed.
Try writing pcCommPort = "COM3" , now you're setting the value of pcCommPort to the address of "COM3". Previously you were trying to set what pcCommPort pointed at (in this case presumably the constant string "COM2") to your new string. Which isn't what you intended.
Paul
|
|
|
|
|
Thanks Paul -- that was it! I don't know why I didn't catch it myself.
Still looking for some clarification and answers about my original post... your help is greatly appreciated.
|
|
|
|
|
I'm now down to the point where I have the code written for everything up to where I understand -- meaning, the WaitCommEvent part is the only part that needs completing.
Any help with this?
|
|
|
|
|
How can I check if application X is running ?
I’m writing an Update tool for my application and I need the program to
wait until the application quits before continuing.
I don’t think I can use FindWindow since the Title text of the application is not static.
/Mathias
|
|
|
|
|
is it ur own app? if so use Mutex
I want to change Myself..Can u help me?
|
|
|
|
|
Mathias S wrote:
I’m writing an Update tool for my application and I need the program to
wait until the application quits before continuing.
Does the Update tool start application X? If so, WaitForSingleObject() can be used.
Mathias S wrote:
I don’t think I can use FindWindow since the Title text of the application is not static.
Do you know the class of the window? If so, FindWindow() can still be used. In any case, it's not a 100% reliable function in that it relies upon a static caption or class, and it can introduce a deadlock situation.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Is there a sample code which demostrates how to wrap an executable with another exe program. Uses for software protection, etc
Thanks
|
|
|
|
|
See if this article is of any help.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
There is an article on CP that put it into the resources then extract it and run it.
Another that calculates a CRC on the data and check it each time it runs.
To tell you the truth, whatever you'll do it will be crackable. The idea is to make it more dificult to crack.
Check some anti-debugging, anti-cracking and anti-softice.
Then think of packing your exe with one of the free or comercial packers (teLock, petite to name a few)
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hello,
If i Debug my project with the VC++ 6.0 debuger I get no errors, but if I use BoundsChecker I get all kinds of errors, some of which I will post here, so someone out there may tell me if this is something with BoundsChecker or with my code.
First snippet (using mutex to prevent more than one instances of my program)
In the header of my CWinApp derrived main class:
HANDLE m_hMutex;
In the implementation (cpp) file of my CWinApp derrived class:
In InitInstance:
m_hMutex = CreateMutex(NULL, TRUE, _T("somename"));
if(!m_hMutex || GetLastError())
{
CString strMessage, strTitle;
strMessage.LoadString(IDS_APP_MESS1);
strTitle.LoadString(IDS_INFORMATION);
MessageBox(NULL, strMessage, strTitle, MB_OK|MB_ICONERROR);
return FALSE;
}
in the ExitInstance function
if(m_hMutex)
{
ReleaseMutex(m_hMutex);
}
for this code I get no errors under the standard debugger and I get error from BoundsChecker: "Resource leak: allocated by CreateMutexA.....HANDLE:0x00000718
Next I have the following events occuring:
CMyDlg::OnInitDialog
CMyDlg::DestroyWindow
where in the CMyDlg::OnInitDialog I have the following code fragment:
hBitmap = NULL;
hModule = NULL;
hModule = LoadLibrary(_T("resource.dll"));
if (hModule)
{
hBitmap = ::LoadBitmap(hModule, MAKEINTRESOURCE(1000));
ASSERT(hBitmap != NULL);
m_bmp.SetBitmap(hBitmap);
}
and finally at CMyDlg::DestroyWindow I have:
if(hBitmap)
VERIFY(::DeleteObject(hBitmap) != 0);
if(hModule)
VERIFY(FreeLibrary(hModule) != 0);
The error I detect using BoundsChecker is
CIShieldView::OnItemNew
CEntryDlg::OnInitDialog
Entry::DestroyWindow
First-chance exception in IShield.exe (KERNEL32.DLL): 0xC0000005: Access Violation.First-chance exception in IShield.exe (KERNEL32.DLL): 0xC0000005: Access Violation.
What am I doing wrong?
Thanks in advance
|
|
|
|
|
Deian wrote:
What am I doing wrong?
Assuming that BC is 100% accurate, or that it is reporting only on your code. It's been many years since I used BC, but I do remember that it reported a bunch of false positives, and it also reported on internal MFC code (when I obviously was only concerned with code that I had written).
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Well, most of the errors are MFC errors, but I get these, and I think that it will not be difficult for somebody outhere to tell me whether these errors are in my code, or some MFC stuff, and a possible workaround if any.
Thanks, still waiting....
|
|
|
|
|
and also any comments on these first - chance exceptions?! what is the cause for them?
|
|
|
|