|
Just query for 'skin' in your article search and you will see tons of it. From dialogbox to combobox.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Actualy i have my own made JPEG ,BMP, GIF..
and i want to use these a background
and i want to place controls like button , combos etc on that background
|
|
|
|
|
How can i get the locale system time and date?
Can u give some examples?
Please help me..
Thanks everybody...
|
|
|
|
|
Try this, a simple one (MFC)
CTime t = CTime::GetCurrentTime();
struct tm* osTime;
osTime = t.GetLocalTm( NULL );
ASSERT( osTime->tm_mon == 2 );
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
i hope following will help u
CTime stime = CTime::GetCurrentTime();
CString s = stime.Format("%A, %B %d, %Y,%I:%M : %S :%p" );
AfxMessageBox(s);
chk it
take care
|
|
|
|
|
Hi,
I try to use Script Control OCX in VC++ 7.0
i can do that.My problem is that i want to just compile script file by using AddCode method.But it is do compile and run script code.how can i disallow running script:
if (m_TargetEngine == CLSID_JScript)
{
m_ScriptControl.put_Language("JScript");
}
else
{
m_ScriptControl.put_Language("VBScript");
}
m_ScriptControl.put_State(0);
UINT column = 0;
UINT line = 0;
UINT Number;
CString Description;
CString Source;
CString Text;
try
{
//it is also do run but i dont want it do that
m_ScriptControl.AddCode(strCode);
}
catch (...)
{
LPDISPATCH lpdisp = m_ScriptControl.get_Error();
DISPID dispid;
OLECHAR* name = L"Column";
CComVariant result;
HRESULT hr = lpdisp->GetIDsOfNames(IID_NULL,&name,1,GetUserDefaultLCID(),&dispid);
DISPPARAMS params = {NULL,NULL,0,0};
hr = lpdisp->Invoke(dispid,IID_NULL,GetUserDefaultLCID(),DISPATCH_PROPERTYGET,¶ms,&result,NULL,NULL);
column = result.iVal;
name = L"Line";
hr = lpdisp->GetIDsOfNames(IID_NULL,&name,1,GetUserDefaultLCID(),&dispid);
hr = lpdisp->Invoke(dispid,IID_NULL,GetUserDefaultLCID(),DISPATCH_PROPERTYGET,¶ms,&result,NULL,NULL);
line = result.iVal;
name = L"Description";
hr = lpdisp->GetIDsOfNames(IID_NULL,&name,1,GetUserDefaultLCID(),&dispid);
hr = lpdisp->Invoke(dispid,IID_NULL,GetUserDefaultLCID(),DISPATCH_PROPERTYGET,¶ms,&result,NULL,NULL);
Description = CComBSTR(result.bstrVal);
name = L"Source";
hr = lpdisp->GetIDsOfNames(IID_NULL,&name,1,GetUserDefaultLCID(),&dispid);
hr = lpdisp->Invoke(dispid,IID_NULL,GetUserDefaultLCID(),DISPATCH_PROPERTYGET,¶ms,&result,NULL,NULL);
Source = CComBSTR(result.bstrVal);
name = L"Number";
hr = lpdisp->GetIDsOfNames(IID_NULL,&name,1,GetUserDefaultLCID(),&dispid);
hr = lpdisp->Invoke(dispid,IID_NULL,GetUserDefaultLCID(),DISPATCH_PROPERTYGET,¶ms,&result,NULL,NULL);
Number = result.iVal;
name = L"Text";
hr = lpdisp->GetIDsOfNames(IID_NULL,&name,1,GetUserDefaultLCID(),&dispid);
hr = lpdisp->Invoke(dispid,IID_NULL,GetUserDefaultLCID(),DISPATCH_PROPERTYGET,¶ms,&result,NULL,NULL);
Text = CComBSTR(result.bstrVal);
CString strResultFormat;
strResultFormat.Format(_T("Line[%d] Column[%d] %d>> %s %s (%s)"),line,column,Number,Text,Description,Source);
m_TaskList.AddString(strResultFormat);
}
|
|
|
|
|
Hi,
I am unable to simulate Extended ASCII characters from 127 to 254 through keybd_event()function.
keybd_event(0x9A, 0, 0, 0); //0x9A IS HEXA VALUE OF extended ASCII char(154)
keybd_event(0x9A, 0, KEYEVENTF_KEYUP, 0);
/* The below mentioned code has not take any effect
keybd_event(0x9A, 0x45, KEVENTF_EXTENDEDKEY|0, 0);
keybd_event(0x9A, 0x45, KEVENTF_EXTENDEDKEY| KEYEVENTF_ KEYUP, 0);
the said code is delimited by default keyboard driver loaded in microsoft word and not sending message to Word or Excell application in WPARAM wparam (wparam is only using the Virtual keys in keyboard, which is already defined).
*/
keybd_event(0x9A, 0, 0, 0) ;
keybd_event(0x9A, 0, KEYEVENTF_KEYUP, 0) ;
code has not been produce the character "Ü". I want to access the Extended ASCII char codes 127-128. and the character sets should be transmitted to wparam (parameter) in SetWindowsHookEx() function.
I am also having a doubt, whether the wparam (parameter) may how modified in messages i.e. pMsg->(). and how to load the Unicode driver in VC++ programs for accessing the Extended characters.
If any idea or little bit of code available, I will oblige.
Thanking you.
by KKSM
|
|
|
|
|
I think your codes should be written as
keybd_event(0x154, 0, KEYEVENTF_EXTENDEDKEY, 0)
instead.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I am currently trying to create a static library using microsoft VC++ 6.0. As I am new in this area, please bear with me. I have several questions regarding the building and creation of static libraries in VC++:
1. What should I do if my library needs to use another static library? Currently I just add the required .lib files into my project, and because of this my resulting .lib file become quite big in both the debug and release version. Further, since the apps that use my library will also use those static libraries, won't that be a waste of space since those static libraries are linked twice (once in my library and once in the apps)?
2. I already declared a class in a separate header (and implemented it in a .cpp file). My static library will define and provide interface to a class which derives from it. Because the derived class declaration is contained in another file, I now have two header files in my project. Does this mean that any apps that use my library will obtain interfaces to both the base class and derived class? I only want the apps to obtain interfaces to the derived class only.
I hope my question is clear. Thanks a lot!
|
|
|
|
|
Hi,
Static librarys eh.
Well,
1. Nothing. It's the user of your library that will have the problem ). So if your libray, LibraryA uses something from LibraryB, then its your client EXE that will have to link to both LibraryA and LibraryB. Pain eh. Especially if the library you are using is not your own.
2. Yes. Unfortuantly if you put something like
class CDerived : public CBase
{
}
in a header file that is part of your library, the user of your library will also need access to the .H for CBase to compile it.
Unlike DLL's - you can't say export some of CDerived's methods, but none of CBase's.
|
|
|
|
|
Can someone tell me how to capture key presses when they are being entered into a Text box.
I did add the ON_WM_KEYUP and OM_WM_KEYDOWN messages but breakpoints in there procedures (OnkeyDown etc) were never reached.
|
|
|
|
|
Hi Sweep,
One way is to use PreTranslateMessage virtual function, e.g.
BOOL CMyWindow::PreTranslateMessage(MSG* pMsg)
{
BOOL bEatMe = FALSE;
if (pMsg && pMsg->message == WM_KEYDOWN && pMsg->hwnd == m_edit1.GetSafeHwnd())
{
BOOL bShift = (GetKeyState(VK_SHIFT) < 0);
BOOL bCtrl = (GetKeyState(VK_CONTROL) < 0);
BOOL bAlt = (pMsg->message == WM_SYSKEYDOWN);
bEatMe = FALSE;
}
return (bEatMe) ? TRUE:CDialog::PreTranslateMessage(pMsg);
}
If you are trying to do clever things, my advice would be to create a class (derived from CEdit) and use this in your views/dialogs.
Hope this helps,
Andy
|
|
|
|
|
Depends what you want to capture.
If your only intrested in 0 > 9, a > z, A > Z plus a few others like VK_RETURN, VK_ESCAPE etc - the easist way is to add a ON_WM_CHAR handler to your text box class. Anything that has its WM_KEYUP/WM_KEYDOWN translated to a WM_CHAR will be caught this way.
Though - your ON_WM_KEYUP/DOWN handlers should work. Is this text box part of a dialog? Is it being subclased correctly, probably via a DDX_Control?
|
|
|
|
|
The Edit box has not been sub-classed, I assume I need to do that to get the WM_KEYUP/WM_KEYDOWN working.
I just ant to trap the Tab and Return keys.
|
|
|
|
|
lol. Would be them two wouldn't it.
Well, your KEYUP/DOWN handler will and should work for all other keys.
Not however, Tab and return, which are dialog box navigation keys. The system handles these in a different way
"The WM_GETDLGCODE message is sent to the window procedure associated with a control. By default, the system handles all keyboard input to the control; the system interprets certain types of keyboard input as dialog box navigation keys. To override this default behavior, the control can respond to the WM_GETDLGCODE message to indicate the types of input it wants to process itself."
In other words, you'll never get a KEYUP/DOWN for Tab/return as you get a WM_GETDLGCODE which returns DLGC_DEFPUSHBUTTON/DLGC_WANTTAB depending
|
|
|
|
|
So what about Andy's solution of using PreTranslateMessage, would that work?
Or I am stuck!?!
|
|
|
|
|
What they are trying to say is some other alternatives are error prone, subclass your CEdit is better like this article
http://www.codeproject.com/editctrl/NumEditCtl.asp
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
The solution Andy Q gave you should work with tab and enter keys. I used a similar technique to trap Enter key in a form view.
<br />
BOOL CMyFormView::PreTranslateMessage(MSG* pMsg) <br />
{<br />
if(pMsg->message==WM_KEYDOWN) <br />
{ <br />
if(pMsg->wParam == 0x0d)
{<br />
return TRUE;<br />
}<br />
else if(pMsg->wParam == 0x1b)
{<br />
return TRUE;<br />
}<br />
} <br />
<br />
return CFormView::PreTranslateMessage(pMsg); <br />
}<br />
|
|
|
|
|
For example, I want to launch the below file
C:\Windows\Tasks\Low Battery Alarm Program.job
What function can I use to launch the file in VC++ ?
|
|
|
|
|
Can it be executed by just double clicking on it?
If can, you can use ShellExecute(...) to start it, I think.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi,
Through my Windows service i want to create a COM control under some specific user credentials.Do achive this i am doing following set of activities.
a)Calling impesonation API
b)Laoding user profile,environment vaiables for impersonated account
c)Creating a browser control
d)Setting a authentication information that will be used to make calls on
the browser control using CoSetProxyBlanket() API
Even after following above steps, control is getting created under SYSTEM user account.Do need to use to do anything extra like setting DACL?.
What could be the problem?.
thanx in advance.
Here with i am attaching the code
//***************************************
HANDLE hProcToken;
IWebBrowser2 *g_WebBrowser2;
LPSTREAM g_lpStream;
void InitialiseControl()
{
if (!LogonUser( szUserName,
szDomain,
szPassword,
LOGON32_LOGON_NETWORK,
LOGON32_PROVIDER_DEFAULT,
&m_hToken))
{
if (ImpersonateLoggedOnUser(m_hToken))
{
//I am loading user profile,environment vaiables for impersonated
//account and setting WindowStation/Desktop to "winStat0/Desktop"
CoInitialize(NULL);
//Create IBrowserControl instance
HRESULT hr = CoCreateInstance( CLSID_InternetExplorer,NULL,
CLSCTX_INPROC_SERVER,IID_IWebBrowser2,
(void**)&g_WebBrowser2 );
hr = CoSetProxyBlanket(g_WebBrowser2,RPC_C_AUTHN_WINNT,
RPC_C_AUTHZ_NONE, NULL,
RPC_C_AUTHN_LEVEL_DEFAULT,
RPC_C_IMP_LEVEL_IMPERSONATE, // Allow impersonation
NULL,EOAC_DYNAMIC_CLOAKING);
//Marshal interface pointer as browser control is single threaded control
hr = CoMarshalInterThreadInterfaceInStream(
IWebBrowser2 ,g_WebBrowser2,
&g_lpStream );
}
}
} //End Of InitialiseControl
//This method loads HTML page and prints to default printer,this method is called from seperate thread
void Print( char* l_strFileName )
{
if (ImpersonateLoggedOnUser(m_hToken))
{
COleVariant vaURL( l_strFileName );
COleVariant noArg;
CoInitialize(NULL);
//Unmarshal interface pointer
hr = CoGetInterfaceAndReleaseStream( (IStream*)g_lpStream,
IID_IWebBrowser2,(void**)&g_WebBrowser2 );
hr = g_WebBrowser2->Navigate2(vaURL,&noArg,&noArg,
&noArg,&noArg);
//Wait till document gets loaded completely
hr = g_WebBrowser2->ExecWB (OLECMDID_PRINT,
OLECMDEXECOPT_DONTPROMPTUSER
,&noArg,&noArg);
}
}
|
|
|
|
|
The COM register utility allow you to activate activeX or COM server based on user. Normal regsvr32 can't do that but this one can.
You have to thank Rama Krishna for his wonderful article.
http://www.codeproject.com/w2k/regsvrex.asp
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi all,
I am a Beginner in Vc++. I made some dialoge box which includes Three Command button, namely OK,Cancel any Apply.
I want to do operation like Enable/Disable on Apply Button.
So,Please provide me some idea to this work.
Regards
Rajesh
rajesh
|
|
|
|
|
this is the code for want you want about Apply Button
note:IDC_Apply is the id of your Apply Button
CButton* ApplyButton ;
ApplyButton =(CButton*)GetDlgItem(IDC_Apply);
ApplyButton->EnableWindow(false);
ApplyButton->EnableWindow(true);
|
|
|
|
|
Hmmmm
One small thing - EnableWindow takes a BOOL, not a bool.
EnableWindow(false) is not the same as EnableWindow(FALSE) which is what it should be.
Other thing, the 'ApplyButton=(CButton*)GetDlgItem' works only because of MFC. Most people, including me, are gulity of doing it this way - but the recomened MFC way (if you dont belive me, read MSDN) is actually like this.
CButton but;
but.Attach(GetDlgItem(IDC_Apply)->GetSafeHwnd());
but.EnableWindow(FALSE);
but.Detach();
More code I know, but your not relying on the evils of non RTTI-safe downcasting.
|
|
|
|
|