|
Hi,
i have created a palette using toolbar.
I'd like to know how can i make a pressed button to be displayed as pressed?
The problem is that the button is released after a mouse click.
i'd like to button to be sunken till a new button is pressed.
Thanks,
Dudi
|
|
|
|
|
OK, found it.
You need to call SetButtonStyle with TBBS_CHECKBOX | TBBS_CHECKGROUP style.
|
|
|
|
|
How to Send an event from an Automation Server to its Client?
Hello,
I wrote an Automation Server. I know how a client can get/set properties belonging to a server, but I am not sure of the right way a Server can fire events to its client.
I tried this solution: (It does actually work, but maybe this solution is "naive" and will not work in some cases)
1) The client sends (once for good), the handle of its main window (or its thread ID.
2) When the server wants to fire an event to the client, it calls either ::SendMessage or ::PostThreadMessage with an agreed message number.
Is there a better solution?
I read about IConnectionPoint. Is this relevant to my problem? Can you send me a link to an example?
Many Thanks,
Mike
|
|
|
|
|
Your solution may work, but of course "::SendMessage/::PostThreadMessage" is an ugliest soultion around (unless you don't see your server with some other client).
Adding connection point interface is straight forward: check this:
http://www.microsoft.com/msj/0598/wicked0598.aspx
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
I want to change the font of a CEdit editbox. I used "void SetFont( CFont* pFont, BOOL bRedraw = TRUE )" function but it doesn't work what could be the problem. Is there other way out? Plz reply only after doing this practically.
Thanking u in anticipation.
Ravi Prabhakar
|
|
|
|
|
What you did should work.
However, it will not work if CFont * is declared in the stack. You can use a member variable instead.
Examples:
void CMyClass::IncorrectFunction()
{
CFont *font;
LOGFONT lf; // Used to create the CFont.
memset(&lf, 0, sizeof(LOGFONT)); // Clear out structure.
lf.lfHeight = 20; // Request a 20-pixel-high font
strcpy(lf.lfFaceName, "Arial"); // with face name "Arial".
font.CreateFontIndirect(&lf); // Create the font.
m_Sample.SetFont(&font);
}
void CMyClass::CorrectFunction()
{
// CFont *m_font; // m_font is declared as a mmber of CMyClass
LOGFONT lf; // Used to create the CFont.
memset(&lf, 0, sizeof(LOGFONT)); // Clear out structure.
lf.lfHeight = 20; // Request a 20-pixel-high font
strcpy(lf.lfFaceName, "Arial"); // with face name "Arial".
m_font.CreateFontIndirect(&lf); // Create the font.
m_Sample.SetFont(&m_font);
}
Hope it helps,
Mike
|
|
|
|
|
Hi, I'm trying to implement drag and drop for my application and, as a start (having done a bit of reading), have created a standard MDI ap using Developer Studio. In the view, I have (i) overridden InitInstance()and added m_OleDropTarget.Register(this); where m_OleDropTarget is a COleDropTarget object and (ii) added the function OnDragEnter() using Class Wizard. Having set a break point in OnDragEnter(), I ran the ap., opened Window Explorer, and dragged a file across my ap’s view. However, I didn’t reach the breakpoint. I have now discovered that Register() function fails on the last line shown below:-
BOOL COleDropTarget::Register(CWnd* pWnd)
{
ASSERT_VALID(this);
ASSERT(m_hWnd == NULL); // registering drop target twice?
ASSERT_VALID(pWnd);
LPUNKNOWN lpUnknown = (LPUNKNOWN)GetInterface(&IID_IUnknown);
ASSERT(lpUnknown != NULL);
// the object must be locked externally to keep LRPC connections alive
if (CoLockObjectExternal(lpUnknown, TRUE, FALSE) != S_OK)
return FALSE;
…..
…..
}
I don’t understand the comment that “the object must be locked exrernally tokeep LRPC connections alive”
And therefore what is causing the failure. Can anyone enlighten me as to what I need to do in my test ap to overcome this failure ?
Doug
|
|
|
|
|
Did you call CoInitialize[Ex]() ?
--
Talk to the hand!
|
|
|
|
|
Jörgen Sigvardsson wrote:
Did you call CoInitialize[Ex]()?
Hi Jorgen - thanks for the reply. I found my problem just after I made the posting (typical, eh !!) - I needed to select the tick boxes for OLE Automation and OLE Controls when generating the project using AppWizard - it doesn't seem to have included COInitialize() in my source files, but it's got me over the problem, until the next one pops up ...... ! Thanks again !;)
Doug
|
|
|
|
|
I finally settled on this but am still uneasy.
HINSTANCE res = ShellExecute(NULL,"Open", helpFile, "","E:\\", SW_SHOWNORMAL);
int r = (int)res;
if(r <=32)ShellExecute(NULL,"Open", helpFile, "","C:\\", SW_SHOWNORMAL);
I imagine all I need in the 5th paramtere is the drive letter where the explorer exe is stored. My assumption that its either in E or C is dangerous. How should I handle this dilemma?
Thanks,
ns
|
|
|
|
|
SHELLEXECUTEINFO sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof (SHELLEXECUTEINFO);
sei.lpVerb = NULL;
sei.lpFile = m_strYourEXEFile;
sei.nShow = SW_SHOW;
sei.hInstApp = NULL;
sei.lpDirectory = NULL;
sei.fMask = SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS;
sei.lpParameters = NULL;
if (ShellExecuteEx (&sei) )
return TRUE;
else
return FALSE;
}
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
I think I didnt explain right: I want the .htm file to open up in explorer. Its not an exe file.
Thanks,
ns
|
|
|
|
|
|
sorry my mistake.
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Visual C++ 6.0/SP5
I have written a program that sets folders to be either "hidden" or "normal" (based on user selections). This program works just fine on Win2K and WinXP, but Win98 users aren't seeing any success at all. Here's the code I'm using:
void CMyClass::ChangeFolderAttributes(CPersonality* pItem)
{
if (g_pPersonHelper->GetChangeTrackFiles())
{
CTracksINI* pTracksINI = GetSimTrackList(SIM_NR2K3);
if (pTracksINI)
{
CString sInstalledTrackDir = "";
CString sInstalledFullPath = "";
int nInstalledCount = pTracksINI->GetCount();
for (int i = 0; i < nInstalledCount; i++)
{
sInstalledTrackDir = pTracksINI->GetTrack(i)->GetTrackDir();
sInstalledFullPath.Format("%stracks\\%s", m_sSimPath, sInstalledTrackDir);
bool bInTrackSet = g_pTrackSetHelper->GetTrackSet(pItem->GetTrackSet())->TrackIsInSet(sInstalledTrackDir);
DWORD dwDesiredAttrib = (bInTrackSet) ? FILE_ATTRIBUTE_NORMAL : FILE_ATTRIBUTE_HIDDEN;
BOOL bResult = SetFileAttributes((LPCTSTR)sInstalledFullPath, dwDesiredAttrib);
}
}
else
{
}
}
else
{
}
}
I've scoured the MSDN stuff, google the API calls, and checked a number of programming bulletin boards, but there is no mention of an incompatibility.
The one thing I did notice is that when I manually select a folder and set it to hidden (using Windows Explorer) Win2k asks is I also want to hide all of the sub-items. I don't have a Win9x box, so I can't see if Win9x does the same thing, but I don't remember that happening.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
"You won't like me when I'm angry..." - Dr. Bruce Banner
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Two things I'd change.
1. The line that builds the full path:
sInstalledFullPath.Format("%stracks\\%s", m_sSimPath, sInstalledTrackDir); is assuming backslashes in certain places. Is that always right? I'd use the shlwapi functions instead (like PathAppend() ) to build the name.
2. You're calling SetFileAttributes() without getting the existing attributes first. This results in you unsetting the FILE_ATTRIBUTE_DIRECTORY attribute, which might be what's causing the error. You should always get the current attrs and modify them. I'd do:
DWORD dwAttrs = GetFileAttributes ( sInstalledFullPath );
DWORD dwDesiredAttrib = bInTrackSet ? FILE_ATTRIBUTE_NORMAL : FILE_ATTRIBUTE_HIDDEN;
if ( INVALID_FILE_ATTRIBUTES == dwAttrs )
else
{
dwAttrs &= ~(FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_HIDDEN);
dwAttrs |= dwDesiredAttrib;
BOOL bResult = SetFileAttributes ( sInstalledFullPath, dwAttrs );
}
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
How Creating Login with Password included by Dot?
I need to connected also thru Telnet/FTP but to access to a Tandem machine (or whatever server types)from these must be(for example:"User=yulisa,password=yls.11").
-Also,How to facilitate Fstream(input.dat -->output.dat),which
at the middle after recieve from input.dat, I must absorb each/all field's value to Edit Boxes navigated by Next-Previous Icon,or by DBGrid provided by MFC,then all those records can be Restored to Database,ex:SQL Server for next purposes manipulation???(maybe Database as the Output File)
....I Need the Right Ansewr Soon, Thanks a Lot Before....
|
|
|
|
|
How Creating Login with Password included by Dot?
|
|
|
|
|
Hi all ,
does any body knows any thing about programming USB Port or IEEE 1394 (Firewire)
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
For visual c++ can provide the help or explanation button usage...Mean that when the mouse cursor point to any button there can provide explanation function of this button!!!
|
|
|
|
|
|
Hi,
I wrote a program using the CFile object.It is giving the following error.
c:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
I included windows.h and afx.h as headers.What else should I include to get rid of this problem
Karteek
|
|
|
|
|
karteek wrote:
I included windows.h and afx.h as headers.What else should I include to get rid of this problem
Don't inlcude windows.h, afxv_w32.h takes care of that for you via afx.h.
Putting the laughter back into slaughter
|
|
|
|
|
My System-Menu only contains 'Close' and 'Move' commands.
What am I missing ? any specific style ?
|
|
|
|
|