|
I have specified WS_HSCROLL and WS_VSCROLL for my list box in the resource file.
When the listbox is full vertically, the vertical scrollbar shows up as expected. However, when a long item is entered into the list box, the horizontal scroll bars do not show up. Why would the vertical ones show up and not the horizontal ones?
I would appreciate any help on getting the horizontal ones to show up properly also.
Thanks.
Martin
|
|
|
|
|
when adding strings to the list box, you need to set the horizontal text extent so that the listbox knows that it needs to put up the horizontal scroll bars (one of my pet peeves!)
<br />
int nExtent = m_ErrorList.GetHorizontalExtent();<br />
CDC *pDC = GetDC();<br />
CSize sizeTextExtent;<br />
<br />
if ( m_pStrings )<br />
{<br />
CString cstrString;<br />
for( int i=0; i < m_pStrings->GetSize(); i++ )<br />
{ <br />
cstrString = m_pStrings->GetAt( i );<br />
sizeTextExtent = pDC->GetTextExtent( cstrString, cstrString.GetLength() );<br />
if ( sizeTextExtent.cx > nExtent )<br />
nExtent = sizeTextExtent.cx;<br />
<br />
m_ErrorList.AddString( cstrString );<br />
}<br />
}<br />
<br />
m_ErrorList.SetHorizontalExtent( nExtent );<br />
ReleaseDC( pDC );<br />
|
|
|
|
|
|
Hello,
I don’t quite understand how everything works with sockets, and was wondering if someone could clear up a few questions I have.
Dealing with stream sockets.
To make this easier for me to understand I will give you a simple example. Lets say I have a server application and several clients. Lets say one of the clients sends some data to the server.
My first question is - In the server application does the server socket wait until it receives everything from the client before it issues a FD_READ to the application?
Second question, (if the first question is no and I'm sure it is) is there a maximum size that you can send through a socket to ensure that the data isn’t chopped up so that the FD_READ issued is guaranteed to be the full amount of data sent and not part of it?
I have a bad feeling that both the answers to my questions are no and this can make it really difficult to keep track of who sent what especially dealing with lots of clients sending data to the server.
Last but not least can anyone recommend a good WinSock book? I have Network Programming with Windows Sockets by Pat Bonner. It’s pretty good but most of the material deals with one client and one server, and it geared toward WinSock1.
Thanks for taking the time to read my post!!
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Are you wanting to read text from the socket one complete line at a time?
|
|
|
|
|
Pretty much.. I am actually sending a Structure through the socket.. and after some debugging I find that sometimes I get a FD_READ issued and only half of the structure is there to read..
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
OK, well i created this[^] to grab text out of a socket one line at a time... binary is somewhat similar, but instead of looking for a line of text (with \n being the end indicator) you would look for a particular structure... and instead of a "ReadTextLine" function you would need something like a "ReadStruct" to get the structure out. similar concepts. basically collect what you get, put it in something, and then when you get what you want, take it back out and use it.
|
|
|
|
|
If all else fails, try the FAQ.
http://tangentsoft.net/wskfaq/[^]
There is a book review section as well.
It is amazing what you can accomplish if you do not care who gets the credit. - Harry S Truman
|
|
|
|
|
Why doesnt my program recive them the messages seem to go straigh to the toolbar i have tried to map OnKeyUp OnKeyDown OnChar all at once and non work
here is the code im using for all 3 of them
void DlgMapEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
switch(nChar)
{
case VK_UP:
curr_room.y -= 1;
MessageBox("Key Up OnChar");
break;
case VK_DOWN:
curr_room.y += 1;
break;
case VK_LEFT:
curr_room.x -= 1;
break;
case VK_RIGHT:
curr_room.x += 1;
break;
}
UpdateDisplay();
CDialog::OnChar(nChar, nRepCnt, nFlags);
}
the code for all 3 is relitivly the same but it doesnt even get to the message box
so whats the deal is there something special i have to do?
when i hit the arrow keys it moves around the selected button on the toolbar and i dont want that :P
i also tried to use OnSysKeyUp OnSysKeyDown and OnSysKeyChar but none of them work it all goes to the toolbar
SOMEONE PLEASE HELP!!!!!
thanks
|
|
|
|
|
Dialogs do there own keyboard handling, so you won't see keys like VK_UP. You'll need to get in before the normal dialog processing does. Try PreTranslateMessage() - not sure if that works with dialogs though.
Hooking these keys in a dialog seems strange though.
If you look below the editing window you will see a toolbar to format code etc. Please try and use that.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I am thinking of buying "Microsoft Visual C++ .NET (Standard)" but I am confussed about the ".NET" bit. I am a C++ programmer - I program Win32 (sometimes MFC but usually just Win32) and DirectX (i am currently using VC++ 6) and I was wondering if this new version of VC++ allows you to create programs without having to use the .NET framework (basically like you would normally with VC6)?
|
|
|
|
|
|
Anonymous wrote:
I am a C++ programmer - I program Win32 ... and DirectX
One good reason to upgrade to VS.NET for DirectX development is the DirectX debugging extensions for VS.NET (including shader debugging, breakpoints on screen areas, texture inspection, etc.) that is included with the DX9 SDK (you'll need to reinstall the SDK after installing VS.NET and you currently need to be on WinXP).
- Mike
|
|
|
|
|
Thanks to both of you for your quick responce.
|
|
|
|
|
On the fly, I want my prog to make a list of the files in a directory. SO in DOS I would say
e:\> cd myDir<br />
<br />
myDir:\> dir/b > myList.txt . How do I get this functionality to occur in my MFC program?
Thanks
Appreciate your help,
ns
|
|
|
|
|
Create a CFileFind object. For each file found, write the name to a CStdioFile object.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Use the CFileFind class in MFC
See this URL :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cfilefind
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Thanks so much. Its exactly what I need! The sample code is right there in your link!
Appreciate your help,
ns
|
|
|
|
|
|
Hi, I'm developping a gui for a command based application and I need to launch and terminate that command based program. The gui runs on a windows platform and the command-based program runs in unix platforms and also in windows (there are 2 versions). I also need the ability of copying and retrieving files (also retrieve file properties such as size and time, etc).
So the question is simple:
Which technology should I use in my gui to "communicate" (launch/kill) with that multiplatform command-based program? Should I use RPC or there's another technology better for this specific case?
Thanks in advance.
|
|
|
|
|
xatanu wrote:
Which technology should I use in my gui to "communicate" (launch/kill) with that multiplatform command-based program?
If it (i.e., the command based application) resides on a machine separate from the GUI machine, check out RPC.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thank you very much for your fast answer.
The problem is when the command based app resides on a different machine: i'll check RPC.
When it resides on the same machine i think it's quite simple using ShellExecute.
Can you advise me some documentation about RPC that could help me?
I think there's an easier method: using rsh (remote shell) commands for launching and retrieving files, but then it's not possible to kill the processes. What do you think about this method?
Greets
|
|
|
|
|
Alright you guru's. I have a question for ya. I have a test application that at first I set all the GDI objects (boxes, Rich Edit control, and lines) using the MM_TEXT (display locations). I found out what a logical inch was (Using MM_TWIPS at 1440x1440) and converted that to display for the current display and printer. On my main system the conversion from LPtoDP returned 102x108 and for the printer 1201x1204. When I copied the application to a different OS (using VMWARE), with the resolution set to 1024x768 and doing the same thing, it returned either 81x81 (or 96x96) and the printer varried by 1 or 2 (probably due to rounding). When I would print using the display locations, I wanted the boxes to be 1inch x 3inch and 1inch x 7 inches. The print outs as I expected were not 1x3 or 1x7 or even close. Using the Logical units they were pretty close!
Next I tried switching all the values to TWIPS and then converting the TWIPS to display units to create the controls. On my main system, it looked darn good. On the VMWARE Os, the output looked different.
What I need is several fold.
- Am I correct in saving the logical (TWIPS) values and using LPtoDP to convert to display units to create the controls?
- Is my assmption correct in saying that 1440x1440 converting to LPtoDP gives the correct DPI for one inch the way the display is configured?
- What are the traps that I maybe falling into and how do I avoid them. Device independent drawing.
Thanks
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
HUMMM, I maybe assuming something that is not correct!
The code to calculate the LPtoDP is as follows:
Lx = Logical x direction
WOx = Window Org x direction
VOx = Viewport Org x direction
WEx = Window Extent x direction
VEx = Viewport Extent x direction
Dx = Device Unit x direction
Dx = ( Lx - WOx ) * VEx / WEx + VOx
So, with this knowledge in a 1280x1024 resolution screen the values are as follows:
Dx = ( 1440 - 0 ) * 1280 / 18142 + 0
Dx = 101.598501 and rounded up to 102.
When this same calculation is done on a 1024x768 screen the value rounded come out to be 81.
So, the question is how do I get the text (rich edit... starting to hate these things!) that was created in a 1024x768 res screen like it did when it was created in a 1280x1024?
Do I come up with some puzzles or what?
Thanks if you can answer. I really guess I don't quite understand!
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
I want to do something like "Print Screen" button do. when you press this button you can capture what ever is visible on the monitor as an image. How can I do it.I want to take some parts in the screen but I guess functionality is the same as getting all the screen.
Mazy
No sig. available now.
|
|
|
|