|
This will probably be an easy question for most people, but I'm still somewhat new using the visual studios, and I haven't had much luck researching scrollbars. I am not trying to use a scrollbar to control my main dialog, which is what most articles refer to. I am trying to put a scroll bar in the middle of a dialog that will manipulate a separate control. Basically, I don't know how to wire up my scroll bar after I've added it to my dialog, and there isn't an easy way to add a message handler. If this is just a message map solution, could you please show me a small example with your answer? Thanks a ton!! ;)
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
Handle WM_VSCROLL or WM_HSCROLL, depending on which direction your scroll bar goes. The last parameter has a pointer to the scroll bar that is sending the message.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Any tools out there for simplifying touch screen application development. Specifically, an onscreen keyboard which is "attached" to an existing CEdit control would be great. Otherwise, I'll have to roll my own.
Thanks!
|
|
|
|
|
Hi,
When you create a splitter window there are some bars between the views. You can use there bars to redimension the views. Is there a way to hide these bars? So that the views will appear as one single view...
Thanks
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
Derive your own class from CSplitterWnd, then override the OnDrawSplitter function. Look in winsplitt.cpp to see the original implementation.
|
|
|
|
|
Is there an equivalent to .Net's GetCurrentMethod for Visual C++ 6?
|
|
|
|
|
Not easily. C++ doesn't provide reflection type information in the way .NET and Java do, meaning that it is very difficult to determine what method you are in etc. unless you implement an appropriate framework yourself.
The other alternative is to build your application with symbols, and then use the stack walking functions to determine where you are - that's not a particularly nice way of doing it though.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Hiya I have a global variable in my lib called 'end'. I really need to have it there, otherwise I would just take it out. My problem is that I need to get the lenght of my file in bytes, so I use
ReadFile.Seek( 0,CFile::end );
MyFileSize = ReadFile.GetPosition();
But this is giving me a error of "constant: illegal token on right side of '::', because of my global variable named the same.
Is there another way to get the lenght of my file without using CFile::end in MFC??
Thanks.
|
|
|
|
|
|
|
Wouldn't the CRT function _filelength() be faster?
onwards and upwards...
|
|
|
|
|
There are two ways to do that:
1) If you have already opened the file use this:
CFileStatus status;
ReadFile.GetStatus(status);
LONG size = status.m_size;
2) more general way is this:
CFileStatus status;
CFile::GetStatus(_T("myfile.dat"),status);
LONG size = status.m_size;
|
|
|
|
|
I'm doing a get text on a drop down box into a CString. I then do a strcpy to a char array so that I can pass this info off to a LPSTR in a cobol DLL.
When I do a GetWindowText on this combo box and then do my strcpy I get an Assertion failed.
So how can I get this info and convert it to a LPSTR with out doing a strcpy. And How do I delete the char array when I'm finished with it?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
The assertion generally means that the code has detected that you are calling it incorrectly. So:
1) Post the code that is causing the problem.
2) Where is the assertion occurring? Is it in the GetWindowText()? In the strcpy()? Or somewhere in your code?
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Okay. Here is some of my code.
CString CSRAgcy;<br />
char shold[4];<br />
<br />
m_CBAgencyList.GetWindowText(CSRAgcy);<br />
strcpy(shold, CSRAgcy);
It errors out when I do the strcpy. If I comment out that line my program works fine.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
What's probably happening is that your string is longer than 3 characters, and so the assertion is warning you that you are overwriting memory that you shouldn't.
You need to allocate enough memory to hold the entire string:
CString sTmp;
m_CBAgencyList.GetWindowText( sTmp );
char* pszAgency = new char[sTmp.GetLength()+1];
strcpy( pszAgency, sTmp );
// Do something with pszAgency
delete[] pszAgency;
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Thanks dave that did it. Can you explain in english what the line:
char* pszAgency = new char[sTmp.GetLength()+1];
does? Is it redefining a char array?
Thanks
Tom
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
The new operator allocates a block of memory, which is an array of chars, of length sTemp.GetLength()+1. The +1 is needed because in C/C++, strings are null-terminated, and the length of a string does not include the null-terminator.
char* pszAgency defines a pointer to a character, which in this case is the start of the block of memory we have just allocated.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Again thanks for the help. That explained it clearly.
Tom
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
wouldn't be a little more efficient to just send the CB_GETTEXT message, passing the LPSTR to be filled in directly, rather than creating a CString, having the framework do what I just said, and converting it to an LPSTR? Also, I think that the other message would be CB_GETTEXTLEN?
onwards and upwards...
|
|
|
|
|
It would be more efficient, but probably not worth the effort, here as it is to be used in a cobol DLL. Since the text is to be retrieved from a combo box, it is unlikely to be very long either, so the little execution time saved is probably not very relevant here.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
While using simple MAPI in VC++ , how should I be specifying the Mail server addresses ?
|
|
|
|
|
Either by host name or IP address. If you use host name and it doesn't work, it could indicate a DNS problem.
|
|
|
|
|
I have script host embeded inside my MFC & ATL app.
It mostly reads/executes JScript code sending results back to MFC View to be displayed.
Program runs very fast when started from local drive, also I can place all scripts on shared netware volume and it will still take less then 1sec to display interface.
Trouble comes when executable is placed on netware volume. It takes 25sec to display first screen vs << 1sec local. After that everything runs fast again.
Profile lists
CWinThread::PumpMessage 27.9 seconds
AfxWinMain 31.8 seconds
IsLink 4.5 seconds
CMDIFrame::DefWindowProcA 3.5second
Not entirely unexpected as looks like system is waiting....
Numega TrueTime even more dramatic:
Application time: 0.29%
System Time : 99.71%
System Time: WaitForMultipleObjectsEx 99%
This function has been called by LoadRegTypeLib 90%
and GetFileAttribEx - 5%....
Those function called 100% by SetScriptState(SCRIPTSTATE_CONNECTED);
Have anybody seen such behaviour????
Any1 aware of any issues btw Netware and MFC & ATL?
P.S. I tried to SetCurrentDirectory to temp and it had no imact...
Compress executable with UPX... UPX unpacks file inside env "C:\TEMP" still darn 25seconds plus to start....
Any suggestions....
Thanks
Brian
|
|
|
|
|
I have a Winhelp file that calls a Microsoft DLL named HLP95EN.DLL
RR("HLP95EN.DLL","MsoCF","I=SII")
Here's what I know about this:
1. RR() is used to register a routine, which can then be used as a macro by Winhelp
2. the routine's name is "MsoCF"
3. the "I=SII" lists the routine's parameter types: LPSTR, int, int
Here's what I don't know:
1. what does this routine do?
2. in general, is there a way to get the contents of a Microsoft routine?
3. what does the "I= mean?
4. I understand that LPSTR specifies a pointer to a string, but since a Winhelp file is not a C program, I can't see how to assign a pointer to a string.
Could I send an actual string, eg: MsoCF("banana",1,2)?
I appreciate your help,
Al
|
|
|
|