|
I want to chanhe background at usual button ?
It is possible to redefine base class, so on...
What need to do ?
Thanks.
|
|
|
|
|
Do you wish to change the background color of a control or a dialog or what? If your question is to change a buttons color search this website for subclassing buttons. Chris and alot of folks have written fine articles doing this.
Best Wishes,
ez_way
|
|
|
|
|
I need references,
but not folks about folks (about folks).
|
|
|
|
|
I've used this in the past
http://www.codeguru.com/buttonctrl/ClrButton.html[^]
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
Thanks you , but
Some problem:
whenever button I supply to my Dialog,
methid of button
virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
- not called.
What prevents to do it?
May be some handler masks it ?
________________
Often with many wisdom wording,
you can be just deceived, at least by style.
|
|
|
|
|
vgrigor wrote:
What prevents to do it?
The button must be set as an Owner Draw button. This is a property of the button in the resource editor on the Styles tab.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
"The button must be set as an Owner Draw button. This is a property of the button in the resource editor on the Styles tab." -very useful advice.
thanks you.
I had lot of trouble make button working emulating it self.
___________________
Right news:
http://www.theinquirer.net/?article=13957
Phyllis Quota thinks outside the box
|
|
|
|
|
hi
i use LoadMenu after SetThreadLocale to bring up Hebrew menus and replace the English ones with them. the problem is that whenever i close all documents or open a new document when no doc is open the new menu is opened in English while the thread locale is set to Hebrew.
what's wrong?
i use the following method to change the current menu lang:
UINT getDocTemplateId(CDocTemplate* pDocTemplate)
{
// Helper class to extract the m_nIDResource member
class CHelperDocTemplate : public CDocTemplate
{
public:
CHelperDocTemplate():CDocTemplate(0, NULL, NULL, NULL){}
UINT GetResourceId(){return m_nIDResource;}
};
return ((CHelperDocTemplate*)pDocTemplate)->GetResourceId();
}
void CMainFrame::pr_changeLanguage(AeLanguage lang)
{
SetThreadLocale(MAKELCID(MAKELANGID((lang==langFarsi)?LANG_ARABIC:LANG_ENGLISH,SUBLANG_DEFAULT),SORT_DEFAULT));
CMDIChildWnd *pChildWnd=MDIGetActive();
HMENU hMenu=LoadMenu(NULL,MAKEINTRESOURCE(pChildWnd?getDocTemplateId(pChildWnd->GetActiveDocument()->GetDocTemplate()):m_nIDHelp));
DelayUpdateFrameMenu(hMenu);
}
thank u
|
|
|
|
|
Your best option would be to change which menu gets loaded into the CDocTemplate m_hMenuShared member variable. You already inherit CDocTempte, so call a function which destroys the exising english menu and loads in the hebrew one. Then you do not need to worry about switching the menus everytime a document is opened/closed. You can also do the same for CFrameWnd::m_hMenuDefault, which is the menu used when no document is open.
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
hello,
how to get tutorial information abt all MFC controls in any site ...
please tell the important sites....
abt edit,list tree,combo,radio,button,textbox &&& other controls !!!
please inform important sites...
thanks
panda
|
|
|
|
|
This site is probally the best, look at the articles, most have fine prg. Look at John Newcommer's articles. Paul DiLisca at msdn at microsoft.com, codeguru.com code-planet.com
p.j. naughter (naughter.com)
Everything you need to know!
Best Wishes,
ez_way
|
|
|
|
|
hey i have the following hard problem:
depending on menu selections in my sdi application, different dialogs should be open (non modal). Each of these dialogs has it's own class and resources. Is there a way when user select menu item "1" to open a specific dialog without using a switch and declaring all classes as membervariables.
My code:
iID is the selected item...
<.h> <br />
<br />
C/C++ Code: <br />
CDialog1 m_dialog1; <br />
CDialog2 m_dialog2; <br />
CDialog3 m_dialog3;<br />
<br />
C/C++ Code: .........
<.cpp> <br />
<br />
C/C++ Code: <br />
bool CreateMyDialog(int iID, ....) <br />
{ <br />
switch (iID) <br />
{ <br />
case 1: <br />
m_dialog1.create(IDD_DIALOG1,this); <br />
m_dialog1.m_Data = "hello, Dialog1"; <br />
case 2: <br />
m_dialog2.create(IDD_DIALOG2,this); <br />
m_dialog2.m_Data = "hello, Dialog2"; <br />
} <br />
return true; <br />
}
|
|
|
|
|
AnTri wrote:
Is there a way when user select menu item "1" to open a specific dialog without using a switch and declaring all classes as membervariables.
first, you would need a callback for each menu item; second, I think, that your dialog class variables should be class members in the parent class ( or other controller class ) since they are modeless ( non-modal), the variable must not be destroyed when leaving the callback function/method.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I have a splitted window with two seperate views, a right one and a left one, and a horizontal bar at the bottom. Now I want to confine the bar with in the right view -- to make the bar's left side on the splitter's right side, if you've ever used Flash or Dreamweaver, just like the property bar. Dose anybody have any idea? Thanks ahead!
hi ho let's go
|
|
|
|
|
Hi!
I hace a problem. I'm using libpcap for linux and collecting packets from ip-tv. I know that one TS packet are 188 bytes and 7 of them can be put in a IP packet (1316 byte).
When I recieving the IP packet there are 1358 bytes, recieved and the first TS packet start at the 42 bytes (TS starts with 0x47) at the IP packet (1358-42 = 1316 correct), but after 188 bytes further there will be 0x47 again to indicate that there is beginning of a new TS packet, and further 188bytes there will be 0x47 again, but it is not.
Does someone know what is wrong?
my code:
...
while(1)
{
packet=pcap_next(handle, &header);//grab packet
printf("packet with length of %s", header.len);
for(counter=0; counter
|
|
|
|
|
I use WinExec( ) to call up to Window Media Player to play a Movie File . But I want to control that Window Media Player while it was playing.
I mean, I want to create an Application, which have 3 buttons, Stop, Pause, Exit that Window Media Player .
Anyone knows about this ! Please tell me or show me the code.
Thank you !
email : ngoanhvu194@yahoo.com
|
|
|
|
|
MSDN, use MCI Platform SDK and funtion to do it :
MCIWndCreate
MCIWndPlay
MCIWndStop
MCIWndPause
Nho'c Ti`
|
|
|
|
|
do you have a simple code for that ?
Thanks
|
|
|
|
|
Create an MFC Dialog base project and add 3 button Play, Pause, Stop
1. add avarible
HWND m_Player;
2. On init Dialog add code :
// TODO
m_File = "Path your audio file";
m_Player = MCIWndCreate(GetSafeHwnd(), AfxGetInstanceHandle(), WS_CHILD | MCIWNDF_NOMENU | MCIWNDF_NOPLAYBAR, m_File);
3. On Button Event Play, Stop , Play call it
MCIWndPlay(m_Player);
MCIWndStop(m_Player);
MCIWndPause(m_Player); <-- use MCIWndResume(m_Player) to continue
Nho'c Ti`
|
|
|
|
|
or, for a broader range of supported file formats look for DirectShow, there are many samples in the DirectX SDK for your needs
|
|
|
|
|
hi all,
I want to play audio file on internet with my application, help me that how i can use MCI (platform SDK) to play audio file on my free website.
or some idea to do this.
thanks
Nho'c Ti`
|
|
|
|
|
I need to write ActiveX control that can retrieve product version from specified file from ftp or http server. Is there any function in MFC that can do this? Can somebody help me?
Nase.
|
|
|
|
|
Good day ALL.
Such question. I'm try to call SOAP method from NT Service about in the same way:
ISOAPClient* m_pSOAPClient;
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
hr = CoCreateInstance ( __uuidof (SoapClient), NULL, CLSCTX_INPROC_SERVER,
__uuidof (ISOAPClient),(void**) &m_pSOAPClient );
hr = m_pSOAPClient->mssoapinit( A2BSTR( sURL ), L"", L"", L"" );
As a result of execution the last string I'm get error:
The specified module could not be found.
Funnily what not long ago it's work. But when I write similar code at MFC of console application it's work ok.
HELP ME PLEASE!!!!!!!!
|
|
|
|
|
I wanna write a small c program to record HTTP request information to a file and I am curious what precautions will I have to take?
I think basically all I will concern myself with is locking the file, writting to file and unlocking file.
The file will be simple in nature...basically append each request after the other and nothing but CSV format I guess.
Anyways, i'm not writting to a database so I don't think I need to secure data before being written to a file, cuz I can't see any way anyone can make data being sent to a file run any system commands or anything.
There will be no SQL injection hacks here
What should I concern myself with...? I wanna make this thing as small and fast as possible...so...I wanna keep it simple...
p.s- I am aware MySQL would be better, but it isn't in this situation...and I am also aware most servers like Apache...already generate log files...but I need my own...
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
I wrote a code of WAV(C:\\InputFile.wav) to WMA(C:\\OutputFile.wma) of the audio,but it was distempered.Please give a help,thank you in advance.
The following is my code:
#include <windows.h><br />
#include <atlbase.h><br />
#include <comdef.h><br />
#include "D:\WMSDK\WMEncSDK9\include\wmencode.h"<br />
#include <conio.h>
<br />
void main()<br />
{<br />
HRESULT hr;<br />
IWMEncoder* pEncoder;<br />
IWMEncSourceGroupCollection* pSrcGrpColl;<br />
IWMEncSourceGroup* pSrcGrp;<br />
IWMEncSource* pSrc;<br />
IWMEncVideoSource* pSrcVid;<br />
IWMEncAudioSource* pSrcAud;<br />
IPropertyBag* pPropertyBag;<br />
IWMEncProfileCollection* pProColl;<br />
IWMEncProfile* pPro;<br />
IWMEncFile* pFile;<br />
IWMEncAttributes* pAttr;<br />
IWMEncDisplayInfo* pDispInfo;<br />
CComBSTR bstrName = NULL;<br />
long lCount;<br />
int i;<br />
<br />
hr = CoInitialize(NULL);<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = CoCreateInstance(CLSID_WMEncoder,<br />
NULL,<br />
CLSCTX_INPROC_SERVER,<br />
IID_IWMEncoder,<br />
(void**) &pEncoder);<br />
}<br />
<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pEncoder->get_SourceGroupCollection(&pSrcGrpColl);<br />
}<br />
<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pSrcGrpColl->Add(CComBSTR("SG_1"), &pSrcGrp);<br />
}<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pSrcGrp->AddSource(WMENC_AUDIO, &pSrc);<br />
}<br />
<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pSrc->QueryInterface(IID_IWMEncAudioSource, (void**)&pSrcAud);<br />
}<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pSrcAud->SetInput(CComBSTR("C:\\InputFile.wav"));<br />
}<br />
<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pEncoder->get_File(&pFile);<br />
}<br />
if ( SUCCEEDED( hr ) ) <br />
{<br />
hr = pFile->put_LocalFileName(CComBSTR("C:\\OutputFile.wma"));<br />
}<br />
<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pSrcAud->QueryInterface(IID_IPropertyBag, (void**)&pPropertyBag);<br />
}<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pEncoder->get_ProfileCollection(&pProColl);<br />
}<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pProColl->get_Count(&lCount);<br />
}<br />
for (i=0; i<lCount; i++)<br />
{<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pProColl->Item(i, &pPro);<br />
}<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pPro->get_Name(&bstrName);<br />
}<br />
if (_wcsicmp(bstrName,CComBSTR("Windows Media Video 8 for Local Area Network (384 Kbps)"))==0)<br />
{<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pSrcGrp->put_Profile(CComVariant(pPro));<br />
}<br />
break;<br />
}<br />
}<br />
<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pEncoder->PrepareToEncode(VARIANT_TRUE);<br />
} <br />
if ( SUCCEEDED( hr ) )<br />
{<br />
hr = pEncoder->Start();<br />
printf("When encoding stops, press a key to close the console window.");<br />
<br />
if ( SUCCEEDED( hr ) )<br />
{<br />
while(!kbhit())<br />
_asm nop;<br />
<br />
hr = pEncoder->Stop();<br />
}<br />
}<br />
<br />
if ( pPropertyBag )<br />
{<br />
pPropertyBag->Release();<br />
pPropertyBag = NULL;<br />
}<br />
if ( pSrcGrpColl )<br />
{<br />
pSrcGrpColl->Release();<br />
pSrcGrpColl = NULL;<br />
}<br />
if ( pSrcGrp )<br />
{<br />
pSrcGrp->Release();<br />
pSrcGrp = NULL;<br />
}<br />
if ( pProColl )<br />
{<br />
pProColl->Release();<br />
pProColl = NULL;<br />
}<br />
<br />
if ( pPro )<br />
{<br />
pPro->Release();<br />
pPro = NULL;<br />
} <br />
if ( pFile )<br />
{<br />
pFile->Release();<br />
pFile = NULL;<br />
}<br />
if ( pSrcAud )<br />
{<br />
pSrcAud->Release();<br />
pSrcAud = NULL;<br />
}<br />
if ( pSrcVid )<br />
{<br />
pSrcVid->Release();<br />
pSrcVid = NULL;<br />
}<br />
if ( pSrc )<br />
{<br />
pSrc->Release();<br />
pSrc = NULL;<br />
}<br />
if ( pAttr )<br />
{<br />
pAttr->Release();<br />
pAttr = NULL;<br />
}<br />
<br />
if ( pDispInfo )<br />
{<br />
pDispInfo->Release();<br />
pDispInfo = NULL;<br />
}<br />
if ( pEncoder )<br />
{<br />
pEncoder->Release();<br />
pEncoder = NULL;<br />
}<br />
}
Rap off for you,for me,for our human.
|
|
|
|