|
Thanks, worked like a charm!!
Rob
|
|
|
|
|
I'm looking for a way to have text over a transparent background, I'm not sure of which MFC approach to take, dialog box or window?
Any ideas on making text "appear" as if hovering over all other apps/windows would help out greatly!
Thanks
|
|
|
|
|
I want to send an WM_ACTIVATE message to a CFormView. (Basically I want the view to know when the App isn't the app with focus anymore.) I have code for the CMainFrame that catches it.
The app is also a SDI app. The only relationship I see is in theApp.InitInstance where it goes:
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CGUIDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CGUIView));
How can get WM_ACTIVATE from CMainFrame to CGUIView?
|
|
|
|
|
MFC already has this built-in, CView::OnActivateFrame()
--Mike--
http://home.inreach.com/mdunn/
While I can't be correct on all matters, I can make the reassuring claim that where I am inaccurate, I am at least definitively inaccurate.
your with and
Sonork - 100.10414 AcidHelm
|
|
|
|
|
|
i have been searching the web for info on enabling and disabling a toolbar button but in vain. how can i enable and disable a toolbar button? pls help. thanks a lot.
(my toolbar is declared as m_wndToolBar, and take for example, 1 of the button is declared as ID_COMMAND_PLAY)
|
|
|
|
|
Add an ON_UPDATE_COMMAND_UI handler for the ID_COMMAND_PLAY command.
void CMyClass::OnUpdatePlay (CCmdUI* pCmdUI)
{
if (playable())
pCmdUI->Enable (TRUE);
} /ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Hi all, I just want to know what the easiest way is to have an edit box (which represents an integer, say width/height) and the arrow buttons, which upon pressing up increments the editbox value by one, and upon pressing down decrements the editbox by one? I have tried mercilessly to do this, but alas I have failed.
Thanks guys,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
Use a CSpinButtonCtrl.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Cheers for the response. OK, I see where your going with this, but I`m still unsure as to how to link it to the edit box? I`m using a dialog box to house this control. I have so far placed the edit box and the CSpinButtonCtrl on the dialog. I have created variables for both in the dialog framework (for the CSpin a DDX control is used). Do I still have to "create" the CSpin thingy? or do I link it some other way?
Many Thanks,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
Chambers wrote:
or do I link it some other way?
Yes. Ensure that the ids of the controls are consecutive (spin control > edit control), then set the "AutoBuddy" property of the spin control in the resource editor.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
What do I set the "Auto Buddy" too? the ID value of the edit box I presume? If this is right don`t worry about answering it, I`ll delete it if it works now.
Thanks again,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
What I meant was check the "AutoBuddy" property of the spin control in the resource editor. If your ids are consecutive, the spin control will automatically become the buddy of the previous edit control, which causes them to be linked.
Also, you can position an autobuddy spin control anywhere in the dialog - it will be automagically rendered inside the edit control. So remember to account for the extra space when sizing the edit control.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Right, I`ve managed to get them linked, finally. I had to enter the resource editor and swap the order of the ids around because it kept attaching to the save button i had (which is exactly what you said to do Ravi). However, the numbers go UP when i press the DOWN button, and visa versa. How do I swap them around, so that the up button makes the integer go UP, not blinking down?
Cheers for your help getting me this far Ravi,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
Yes, that's annoying!
I suppose you could override the spin control's notifications and manually set the edit control to do the opposite.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I found an easier way. MSDN help says that, by default, the CSpin thingy's range is set to Min:100 Max , and by clicking the down arrow sends the current value nearer the minimum value, which is why it goes up, its heading for 100. All I did to get it to work properly was call :
CDialog::DoDataExchange(etc.)
{
... min , max
myCSpinThingy.SetRange(0 , 10);
}
and it worked no problem. Just thought I`d let you know, since I wouldn`t have got there in the end if it weren't for you,
Cheers Ravi,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
Is there any component to canvert .txt(richeditview)
to htmlview???Or how can I do that?
|
|
|
|
|
I need IIS ,and I search microsoft web site,but I could not find the setup file of it.Does anybody know where can I find it?
|
|
|
|
|
You can go to www.microsoft.com and search for Nt Option Pack.. here is the link but it maybe too long.
http://search.microsoft.com/default.asp?boolean=ALL&nq=NEW&so=RECCNT&ig=01&ig=02&ig=03&ig=04&ig=05&ig=06&ig=07&ig=08&ig=09&ig=10&i=00&i=01&i=02&i=03&i=04&i=05&i=06&i=07&i=08&i=09&qu=nt%20option%20pack&siteid=us
Rob
|
|
|
|
|
Hi all,
im having real trouble trying to use internet explorer automation. I simply want to use the automation to navigate to a page and then print it but i cant even get the object into my project.
What i have tried to do is by using classwizard to add the IWebBrowser2 interface from the shdocvw.dll. However, simply doing this means that my project no longer compiles and gives me the following error:
shdocvw.h(5) : error C2011: 'IWebBrowser2' : 'struct' type redefinition
which then spawns off loads of other errors.
Can someone please tell me what im doing wrong. This is a very simple task that loads of programmers must have done.
Please reply, all replies will be rated favourably as msdn is so full of shite its hard finding the right answers.
Andy.
|
|
|
|
|
Hey
just want to know what is the easiest way to obtain a bitmap( in fact a handle of a bitmap) from a device context of the client zone of a window in which i have already drawn something
Thx for answer
Bye
|
|
|
|
|
get a dc
create a compatible dc (memory dc)
create a compatible bitmap (memory bmp)
select the memory bmp to the memory dc
bitblt from the screen dc to the memory dc
-c
Smaller Animals Software, Inc.
|
|
|
|
|
Hi,
i have this piece of code
>>>>>>>>>>>>>>>>>>>>>>
struct CAddInfo
{
CAddInfo(){}
CAddInfo(const CString& szName, DWORD iSize, bool bDir = false)
:m_szName(szName), m_iSize(iSize), m_bDir(bDir){}
CString m_szName;
bool m_bDir;
DWORD m_iSize;
};
typedef CList<caddinfo, caddinfo=""> CAddInfoList;
CAddInfoList list;
void CJRZipArchive::AddFolder(CString szFolder)
{
try
{
szFolder.TrimRight(_T("\\"));
CFileFind ff;
BOOL b = ff.FindFile(szFolder + _T("\\*"));
CStringArray folders;
while (b)
{
b = ff.FindNextFile();
if (ff.IsDots())
continue;
if (ff.IsDirectory())
{
folders.Add(ff.GetFilePath());
}
else
{
CAddInfo ai;
ai.m_szName = ff.GetFilePath();
CFileStatus fs;
if (CFile::GetStatus(ai.m_szName, fs))
{
ai.m_bDir = false;
ai.m_iSize = fs.m_size;
list.AddTail(ai);
m_iTotal += fs.m_size;
}
}
}
for (int i = 0; i < folders.GetSize(); i++)
{
list.AddTail(CAddInfo(folders[i], 0, true));
// add the folder before adding its files
// it is not needed to add the root folder
AddFolder(folders[i]);
}
}
catch (CException* e)
{
e->ReportError();
e->Delete();
}
catch(...) // thrown in the STL version
{
AfxMessageBox("Error");
}
}
<<<<<<<<<<<<<<<<<<<<<<<
Sometimes, this causes an ASSERT in the line 40 of timecore.cpp (the last ASSERT of a CTime constructor)...
Does anyone know if there is any situation of a file the should cause it?
Thank u very much,
Dirso.
|
|
|
|
|
Hi All,
I'm having some trouble debugging the following function under Windows 2000 w/ Visual Studio 6.0. Where the function calls the socket API function, the debugger is reporting the following:
HEAP[Sockets.exe]: Heap block at 00140390 modified at 0014070E past requested size of 376
HEAP[Sockets.exe]: Invalid Address specified to RtlReAllocateHeap( 130000, 140398 )
Does anyone see something that I am missing? This function appears to work correctly when executed outside of the debugger (the socket gets bound and can accept connections from other machines), but . . .
Here is the code I am testing:
// Creates a socket in the local machine
SOCKET CreateLocalSocket(int port)
{
SOCKET s = INVALID_SOCKET;
char localHost[256];
hostent* pHostEntry = NULL;
sockaddr_in sa;
// Get the name of this machine
printf("\ngetting local host name . . .");
if(0 != gethostname(localHost, 256))
{
printf("failed.");
return s;
}
else
printf("succeeded.");
printf("\nlocal host name = <%s>", localHost);
// Deprecated function call
printf("\ngetting local host address info . . .");
pHostEntry = gethostbyname(localHost);
if(pHostEntry == NULL)
{
printf("failed.");
return s;
}
else
printf("succeeded.");
// Create a socket
printf("\ncreating socket . . .");
s = socket(AF_INET, SOCK_STREAM, 0);
if(s == INVALID_SOCKET)
{
printf("failed.");
return s;
}
else
printf("succeeded.");
// Set up the socket address struct
memset(&sa, 0, sizeof(sa));
sa.sin_family = pHostEntry->h_addrtype;
sa.sin_port = htons(port);
printf("\nbinding socket . . .");
if(0 != bind(s, (sockaddr*)&sa, sizeof(sa)))
{
printf("failed.");
return s;
}
else
printf("succeeded.");
return s;
}
Thanks in advance for any help.
|
|
|
|
|
Hi to all,I facing some problems when i executed a source code in Visual C++ under MFC environment.Hope someone can help me to solve it.
Well actaully this file is running fine if i compile it under Visual C++ Win32 console application.
But once i put it into Visual C++ MFC environment,it didn't show any error,but it just not fuctioning.
char c;
ofstream modem("COM1:");
printf("Resetting MODEM\n to Dial");
modem << "ATZ\n";
modem.flush();
c = getchar(); // wait for modem to finish
modem <<"ATDT0123246448\n";
modem.flush();
printf(" to Hang-UP\n");
c = getchar(); // wait for modem to finish
modem <<"ATH0\n";
modem.flush();
Hope guru's can help me on this.
Thank you.
|
|
|
|