|
what place should i place the CreateRoundRectRgn() and SetWindowRgn() ?
I've try below code but it seems like the EditBox keep on blinking
CRect rcItem;
CDC* pDC=this->GetDC();
this->GetClientRect(&rcItem);
CRgn rgn;
rgn.CreateRoundRectRgn(rcItem.left, rcItem.top, rcItem.right, rcItem.bottom, 50, 50);
SetWindowRgn( (HRGN)rgn.Detach(), TRUE );
Thanks,
KarHong
good
|
|
|
|
|
karhong wrote: what place should i place the CreateRoundRectRgn() and SetWindowRgn() ?
The PreSubclassWindow() function is a good place.
karhong wrote: CDC* pDC=this->GetDC();
Why are you calling this function?
|
|
|
|
|
oh i'm using the pDC to draw the rectangle. That one I'm just testing out with the link given by Chandrasekharanp
I'm taking pDC out now and try your method.
But after i put below code, and execute it then the button went dissapear
void CCustomEdit::PreSubclassWindow()
{
CRect rcItem;
this->GetClientRect(&rcItem);
CRgn rgn;
rgn.CreateRoundRectRgn(rcItem.left, rcItem.top, rcItem.right, rcItem.bottom, 50, 50);
SetWindowRgn( (HRGN)rgn.Detach(), TRUE );
CEdit::PreSubclassWindow();
}
good
|
|
|
|
|
This may help you
http://www.codeproject.com/KB/edit/EditStyle.aspx
|
|
|
|
|
Hi, I've tested out but the shape of the box is still square.
Thanks for your reply
good
|
|
|
|
|
There are two classe of dialog windows:
class CMainDlg2 : public Cdialog // modal
CString m_sADDRESSHOM;
class CAdderDialog2 : public CDialog // MODELESS
#include "adderdlg2.h"
#include "modeldlg2.h"
There are in the code attached to command button OK set:
m_pModeless7 = new CAdderDialog2(this);
if (m_pModeless7->Create() == TRUE)
{
m_sADDRESSHOM = "London";
}
View the fragment of code modeless window:
BOOL CAdderDialog2::OnInitDialog()
{
CDialog::OnInitDialog();
CMainDlg2 dlg7;
MessageBox(L"dlg7.m_sADDRESSHOM=\n" + dlg7.m_sADDRESSHOM);
// display empty - the contents from constructor of modal
dialog window
}
How to receive "London" ?
|
|
|
|
|
Pass the pointer of the first dialog in the modeless one as you are doing by passing this. Write a get/set function in the modal dialog and declare variable that will be used in get/set functions. Create a pointer variable for the modal dialog in the modeless one and initialize it in the constructor of the modeless dialog since you pass the this pointer. This done, you can invoke the get/set function and set the value in the string to what ever you wish using the modal dialog pointer in the modeless dialog.
Alternatively, you can access the values using the dlg7 object as well.
Hope it is clear.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
I've implemented a method in my app to paste a bitmap from the clipboard as an OLE object. I take the CF_DIB data, write it to a temporary file, and then use COleClientItem::CreateFromFile to create the object.
However, this is subject to the vagaries of file associations and installed applications. I'd like to be able to code something that says 'I want to insert an OLE bitmap object created with mspaint.exe' so that behaviour is more consistent from system to system.
Looking at some of the underlying ::OLE (eg OleCreate) functions, this seems like it might be possible, but I can't make it work. Does anyone with a better understanding of OLE have any tips? (or teh c0d3z? )
Cheers
|
|
|
|
|
Hi All,
How can we validate the edit box such that it accepts only one zero in the first place.
|
|
|
|
|
You should handle the WM_CHAR message in the edit control class and do necessary validation when the key pressed is zero.
|
|
|
|
|
See the EN_CHANGE notification. When the user enters the first character you can check whether it is a 0 or not. If not, you can clear the text in the edit window. So for every EN_CHANGE notification you can take the string from the edit window and check if char at 0th index is 0 or not.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Hi
I tried with EN_CHANGE notification onchange() is like below
CString Str;
char *Ch;
m_Edit1.GetWindowText(Str);
Ch=Str.LockBuffer();
if(*Ch=='0')
{
Str.UnlockBuffer();
m_Edit1.SetWindowText("0");
}
This is giving stack overflow error...
|
|
|
|
|
In EN_CHANGE:
CString str;
m_edit.GetWindowTextA (str);
if(str.GetAt(0)!='0')
{
}
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Thank u very much
|
|
|
|
|
Padmanabha_M wrote: How can we validate the edit box such that it accepts only one zero in the first place.
By reading here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I want to start a simple UI application, actually a message box through a windows service I do the following.
<br />
void OnStart(String* args[])<br />
{<br />
Threading::ThreadStart* threadStart = <br />
new Threading::ThreadStart(this, DoProcess);<br />
servicethread = new Threading::Thread(threadStart);<br />
servicethread->Start();<br />
}<br />
<br />
void DoProcess()<br />
{<br />
m_iSleepTime = 10000;
m_bRunning = true;<br />
<br />
while(m_bRunning)<br />
{<br />
(void)system("UI.exe");<br />
Threading::Thread::Sleep(m_iSleepTime);<br />
}<br />
}<br />
But it doesn't work. Can someone looking into it? I cannot figure out what the error is. Same way I can execute the UI in console application, but not here.
Thanks a lot
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Some documentation which may assist you:
Interactive Services[^]
If you simply want to display a message to the logged on user you can simply call the MessageBox Function[^] and pass the uType of MB_SERVICE_NOTIFICATION. Calling this from your service will cause a messagebox to appear on the active desktop.
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: If you simply want to display a message to the logged on user you can simply call the MessageBox Function[^] and pass the uType of MB_SERVICE_NOTIFICATION. Calling this from your service will cause a messagebox to appear on the active desktop.
I tried this, include the relevant header file as well. Found an error, MB_SERVICE_NOTIFICATION is not defined ...
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: Found an error, MB_SERVICE_NOTIFICATION is not defined ...
Did you look in winuser.h to find out the cause (hint: what is the value of _WIN32_WINNT )?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Is anything wrong with the way I've start/execute the external exe?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: Is anything wrong with the way I've start/execute the external exe?
There are many things wrong. Windows is a multi-desktop and multi-user operating system and your service cannot just start an application. There is much more to it than that. The link below is a good place to start.
Starting an Interactive Client Process in C++[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Hi All,
I've install a windows installation in C++, using installutil command. I got the following error at installation. Anyone of you have any idea what that means is?
Exception occurred while initializing and installation.
System.IO.FileLoadException: Unverifiable image 'MyService.exe' cannot be run...
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: I've install a windows installation in C++, using installutil command.
The Installer Tool[^] is used for installing services created with .NET and uses reflection to 'verify' the service.
Note that you cannot deploy a Windows service created using C++ with Installutil.exe. Installutil.exe cannot recognize the embedded native code that is produced by the C++ compiler. If you attempt to deploy a C++ Windows service with Installutil.exe, an exception such as BadImageFormatException will be thrown.
If you have written the service in Managed C++ try installing your service with MyService.exe -Install
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks a lot. I've read a bit about the installation on services, and I found the same solution as here. Thanks again.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Hi,
Don't know why this is
buf for some reason the the first 4 bytes of the destination buffer gets overlayed with some
seems like address upon return from the CallBack routine
|
|
|
|