|
First of all, thanx for the hint.
I was probably not descriping my question enough.
The thing is, when the list has more items than can be shown and the user selects the item at the bottom of the list window(that are shown, more items below) the listcontrol automatically scroll down(I want it this way,EnsureVisible(...)) one row. This is where the problem start. After it has repainted itself, I need to calculate what items are shown and therefore wants a message from Windows telling me that it has been done, like the message SB_ENDSCROLL associated with CWnd::OnVScroll.
Thanks!
/Mathias
|
|
|
|
|
Maybe you have to take a different approach:
you said:
>>I need to calculate what items are shown
Then you could use this function:
int GetTopIndex( ) const; (=The index of the topmost visible item.)
Since the listcontrol is owner drawn, you should get a WM_DRAWITEM message. You should make a handler for this and then you can use the GetTopIndex function to get the first visible item.
|
|
|
|
|
Hai
Iam interested in writing my own installation program to setup the files.What are concepts and procedures you have to follow .Any help would be appericiated
|
|
|
|
|
Depends on wether you are going to write a general install program or a specific install program just for your application. I'll guess it's the first one you are talking about.
1. It has to be easy to use.
2. Things it needs to do:
2.1. Copy files to a target directory
2.2. Compress files to reduce install size, uncompress them again while installing.
2.3. Ability to make subdirectories and copy files in there
2.4. Make it easy to copy files to certain specific windows directories like system32 or fonts.
2.5. Place (if wanted) icons on desktop.
2.6. Make an entry in start menu
2.7. Possibility to add a certain document type to the system
2.8. Registry control
2.9. Cool looking customizable install screens (different types of setup, license agreement , ... )
2.9. Properly uninstall (=undo all previous steps)
That's about all i can think off. You might want to take a look at this freeware installer that i frequently use, Inno Setup, http://www.jrsoftware.org/
|
|
|
|
|
Is there a special way to make self-extracting .exe's, if I have an .exe file but want to be able to specify a specific config file and zip file.
/XTSea
|
|
|
|
|
You might want to check these links here on codeproject
-> http://www.codeproject.com/useritems/sfxframework.asp
-> http://www.codeproject.com/file/self_extractor.asp
They should help you get started
|
|
|
|
|
I would not suggest you to write your installation program. And according to the new logo requirements of windows you have to install through Windows Installer(MSI). There are variety of reasons to enfore this, since MS beleives installation is one of the main culprit in many "file missing" or dll hell problem.
So you *have* to go through MSI to install your program and I suggest to look at ISWI(InstallShield for WIndows Installer). or Visual Studio Installer.
Regards
Ravi
|
|
|
|
|
I found another great installer that's free. I've found it to be easier to use than pay installer and it has all the features. It's call GP-Install and you can get it at: http://www.qsc.co.uk/ They say that about 5000 applications use it. I would highly recommend checking there before spending any money on a pay installer. It's very professional!
|
|
|
|
|
I have the following situation:
DataDialog::Start()
{
...
m_pDataSet = new CDataSet(m_pDB);
try
{
m_pDataSet->Open()
}
...
}
DataDialog::OnReceiveData()
{
...
if (m_pDataSet->IsOpen())
{
m_pDataSet->AddNew();
...
m_pDataSet->Update();
}
...
}
DataDialog::Stop()
{
...
if (m_pDataSet->IsOpen())
{
try
{
m_pDataSet->Close();
}
...
}
delete m_pDataSet;
...
}
where m_pDataSet is a pointer to an object derived from CDaoRecordSet and m_pDB is a pointer to a CDaoDatabase. My problem is that I get an unhandled exception when I close the data set (the data is stored fine). I tried opening and closing the data set in the OnReceiveData function and that does not crash, but it cannot keep up with the incoming data.
Any suggestions?
Thanks.
|
|
|
|
|
Does anyone know how to get the memory address of a bitmap resource, using it's ID ?
I would appreciate any help !
|
|
|
|
|
FindResource, LoadResource, and LockResource gives you a pointer to read-only data.
|
|
|
|
|
Hi
I have a problem with my application.
i made my application in VC++ 6.0 .
when i tried running that on the user's machine i found out that he is having a different screen resolution.
I developed the application in 600X800 .
but the user's machien is running on 480X600.
How do i do now.
i need my dialog box and all the controls to be visible in this new resolution also.
i cannot statically change the position of all my controls now.
Is there any way .. where i can do it for the dialog box and it gets adjusted for all the controls also?
i used MFC.
Thanks.
|
|
|
|
|
To get the size of the screen:
n_screen_width = GetSystemMetrics(SM_CXSCREEN);
n_screen_height= GetSystemMetrics(SM_CYSCREEN);
Then you can resize a control/window by using these functions:
SetWindowPos( const CWnd* pWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags );
OR
void MoveWindow( int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE );
void MoveWindow( LPCRECT lpRect, BOOL bRepaint = TRUE );
|
|
|
|
|
Hi Thank u.
i have a command button in the right most corner.
i placed it there while certaing the dialog box.
but while running when i changed the screen resolution, that command button was not visible.
where exactly am i supposed to place the
SetWindowPos or MoveWindow functions?
Is it enough if i write for the dialog box onintit or Precreatewindow.
do i have to write the same code for all teh controls inside the dialog box too ???
i am new to VC++.
and this is urjent.
could u pl. provide me some more help on this.
Thank u.
|
|
|
|
|
I think that when you change the screen resolution while your program is running that you receive a WM_PAINT/WM_SIZE message from Windows.
Then you could write an WM_PAINT/WM_SIZE handler that paints the window according to the systemmetrics values.
You can probably just move the command button then to a position where it can be seen on the screen. You can use either of the functions to accomplish this.
Rundown:
-> Receive WM_PAINT/WM_SIZE
-> In WM_PAINT/WM_SIZE handler:
-> check the screenmetrics
-> call SetWindowPos / MoveWindow to place window correctly on screen
-> resize and/or move all controls on the screen
>>do i have to write the same code for all teh controls >>inside the dialog box too ???
as explained above, let the parent window handle this (dialog box)
|
|
|
|
|
Hi,
You may try using a class that simplifies resizing a dialog and all its content. There are a lot of them on CodeProject!
I wrote one, too. If you wish, look at:
CResizableDialog - A CDialog derived class to implement resizable dialogs with MFC.
I think it's quite simple to use. But there are also many other good choices. Look in the Dialog section.
Hope this helps,
Paolo.
|
|
|
|
|
One of the things you either love or hate about VS6 and VC6 is the the "member" list that appears after you've typed "->" or "." after a class or structure name.
When I add members to classes of mine, they are accordingly listed after I type the class name. However I have a header file will lots of structure definitions in a directory different to the main app / source code. If I modify one of these structures, the changes don't seem to be listed when I next type the structure name.
Any ideas why, or what I'm doing wrong please?
Thanks
|
|
|
|
|
This is a common problem, intellisense isn't really reliable in VC++ (and of course much more complicated than in e.g.VB). The advises range from waiting for full moon, step out of your cubicle and howl all night long, to: close the project, delete all temporary files (.opt, aps, .ncb, .clw, although .ncb is the likeliest), reopen the project, and open clazz wizard dialog, to rebuild the clw information. Well, I've found out both methods have their advantages... Good luck!
Peter
|
|
|
|
|
Deleting the .NCB file usually fixes it for me. The other files have nothing to do with IntelliSense. .APS = resource browser data, .OPT = debugging settings, .CLW = ClassWizard data.
|
|
|
|
|
I have an application that contains 5 buttons, when each button is pressed a pop-up menu appears with 3 choices (each menu for each button is identical but performs different tasks). Is there any way to distinguish which menu is being accessed by using any of the CMenu functions or do I have to have message handlers for each menu item based on which button was pressed.
|
|
|
|
|
I think you can use following solutions.
1. Store the number (ID,...) last pressed button
and identify menu using this information.
2. Look MSDN for Menu Messages, especially:
WM_INITMENUPOPUP,
WM_MENUCOMMAND,
WM_MENUSELECT,
WM_UNINITMENUPOPUP
They return menu handle as one of the parameters,
look also for CWnd::OnInitMenuPopup handler.
There is nothing about CMenu functions,
but may be it will help you anyway.
Igor Chouvalov
|
|
|
|
|
How can i create a virtual serial port? An excisting programm uses a serial port to retrieve data. I wont to
use a file instead of the com port. Can anyone help me?
Greetings,
Herbert Slaghekke
|
|
|
|
|
I suppose you do not control (the source) of the existing application. So you have to figure out how it talks to the COM port.
If it uses its own COM driver, you will have to emulate this driver, which can be more difficult (depending on whether you are used to writing drivers) than rewriting the existing application.
If it uses the Win32 CreateFile API call to open the COM port, you can start by either trying to specify an non-existing COM port in the program, let's say port 3. Of course if this port does not exist, the program will not be able to open it. But then again, you could create this "file" yourself and mimic the Win32 COM API mechanism. (if that works, it will be the simpliest solution).
For more information, look at the CreateFile Win32 function with regard to the COM port communications.
If the program uses Hardware flow control, it might be very difficult.
I use the following code in my programs to open a COM port. I could easily 'fool' this code that there is a virtual COM port on the other side. So it depends on the existing program's implementation.
Best regards,
GBO
---
BOOL CSerial::Open()
{
COMMTIMEOUTS timeouts;
DWORD dwSerialStatus;
char szPort[16];
char strTemp[10];
DCB dcb; // Abre el puerto serie
::ZeroMemory(szPort, 16);
::ZeroMemory(strTemp, 10);
strcpy(szPort, "COM");
_ltoa( PortNum, strTemp, 10 );
strupr( strTemp );
strcat(szPort, strTemp);
hCom = CreateFile(szPort, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, 0, NULL);
if (hCom == NULL || hCom == INVALID_HANDLE_VALUE)
{
// try \\.\COMxx
::ZeroMemory(szPort, 16);
strcpy(szPort, "\\\\.\\COM");
strcat(szPort, strTemp);
hCom = CreateFile(szPort, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, 0, NULL);
}
if (hCom != NULL && hCom != INVALID_HANDLE_VALUE)
{
if (GetCommState(hCom, &dcb))
{
// Llena la estructura del DCB
dcb.BaudRate = BaudRate;
dcb.ByteSize = DataBits;
switch (Parity)
{
case 'N' :
dcb.Parity = NOPARITY;
break;
case 'E' :
dcb.Parity = EVENPARITY;
break;
case 'O' :
dcb.Parity = ODDPARITY;
break;
}
dcb.StopBits = ONESTOPBIT;
if (SetCommState (hCom, &dcb))
{
if (GetCommModemStatus (hCom, &dwSerialStatus))
{
// Setea los timeouts de la puerta serie
timeouts.ReadIntervalTimeout = 100;
timeouts.ReadTotalTimeoutMultiplier = 1;
timeouts.ReadTotalTimeoutConstant = 100;
timeouts.WriteTotalTimeoutMultiplier = 1;
timeouts.WriteTotalTimeoutConstant = 100;
if (SetCommTimeouts (hCom, &timeouts))
{
if (PurgeComm(hCom, PURGE_TXCLEAR | PURGE_RXCLEAR |
PURGE_TXABORT | PURGE_RXABORT))
{
if (SetupComm (hCom, RxBufSiz, TxBufSiz))
{
if (EscapeCommFunction(hCom, SETDTR))
{
// All OK
}
else
{
DWORD dwError = ::GetLastError();
_ASSERT(NULL);
}
return TRUE;
}
}
}
}
}
}
}
DWORD dwError = ::GetLastError();
_ASSERT(NULL);
return FALSE;
}
|
|
|
|
|
Is it possible to add a bitmap to a menu without C++ class-based coding?
|
|
|
|
|
Look MSDN for SetMenuItemBitmaps function.
Igor.
|
|
|
|