|
Use the AddString() method. If you are not using MFC, then send the control a CB_ADDSTRING message.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
If you want to get the files also you need to use FindFirstFile() and FindNextFile() .
A quick example of FindFirstFile straight from MSDN
#define _WIN32_WINNT 0x0400<br />
<br />
#include <windows.h><br />
#include <stdio.h><br />
<br />
int main(int argc, char *argv[])<br />
{<br />
WIN32_FIND_DATA FindFileData;<br />
HANDLE hFind;<br />
<br />
printf ("Target file is %s.\n", argv[1]);<br />
hFind = FindFirstFile(argv[1], &FindFileData);<br />
if (hFind == INVALID_HANDLE_VALUE) <br />
{<br />
printf ("Invalid File Handle. GetLastError reports %d\n", GetLastError ());<br />
return (0);<br />
} <br />
else <br />
{<br />
printf ("The first file found is %s\n", FindFileData.cFileName);<br />
FindClose(hFind);<br />
return (1);<br />
}<br />
}
Ant.
|
|
|
|
|
Of course, but since the verb in the original post was "add", it only made sense that the combobox was the subject.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Sorry David my post was not meant as a critisism of yours.
Since English is quite ambiguous I thought I would fill the possible missing part
Ant.
|
|
|
|
|
is there any library which i can use to make a flow chart in VC++
|
|
|
|
|
I'm trying to put together a program to simulate the weakest link scorinbg system. The player is shown a random number and has to guess whether the next random number will be higher or lower than the current one.
For the random number I think I use rand() and then if statments to check the answer.
if edit1 < than edit2 ->then counter move up
could anybody bring this more into focus for me. I design my uml but having trouble with the coding.
nicolas
|
|
|
|
|
set r = pseudo-random number
while not done
prompt user for guess
if guess < r
tell user their guess is too low
else if guess > r
tell user their guess is too high
else
tell user they are right
wend Not much to it.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I've created a control variable to the activex control flexgrid, when I attempt to set the a cell value from another class the program terminates. I've no problem accessing CString variables of the other class its just the control variable (m_ctlFGrid) thats causing the problem.
Any ideas!!!
Kind Regards
Caoimh
|
|
|
|
|
I would really be happy, if someone could sort this problem.
|
|
|
|
|
Windows are represented by handles and they are global to windows rite ?
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Hello
Using MFc i am drawing some figures on the View. Now what i want is to save the content in the device context (Memory device context or client device context) to a Jpeg file.
I had found and searched the codeguru and codeproject projects. But there are code available for conversion of file from BMP to Jpeg and not directly CDC --> Jpeg.
I have gone thru CXImage slighly but there also i found above step only. Can any body help me in saving the CDC to JPEG.
Thanks in advance
Leave your mark wherever you go
|
|
|
|
|
(Didn't I just post this last week?)
Create a Device-Independent Bitmap with CreateDIBSection , select it into a device context compatible with the DC which holds the image you want to save, use BitBlt to copy the saved image to the compatible DC. You can then access the DIB pixel values directly in the array you passed to CreateDIBSection .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks for you kind suggestions.
I want to save my Device Context contents to Jpeg file.
I am newbie and it seems to me that your suggestion will help me to save the dc content to the BMP file.
Can you give me idea how to save this to Jpeg file.
Mike Dimmick wrote:
(Didn't I just post this last week?)
Can you provide me link to that thread. Thanks for your responce
Leave your mark wherever you go
|
|
|
|
|
Hi,
I m a student of MCA final year and I m working in VC. I used a dialog base application. I used BMP's for the background and for every button in the application.
The problem is that whenever I use the DoModal(), to show the next dialog, I get the flickering problem. Anyone know about this problem ??
Thanks in advance.
Please reply soon..
Mayank Kumar
|
|
|
|
|
Handle OnEraseBackground and do nothing just return 0
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Hi Mr. Prakash,
Thanks for the reply. I tried the OnErase method, but the result is same.
Actually, I am using different dialog boxes. Everytime, when I load the next dialog box, I hide the previous one. There is no link between the dialog box. I am simulating the application wizard without using the prperty sheet. I got the flickering problem when I load the next dialog box and hide the previous one.
Do u know anyother method for the flickering problem.
Please reply
Mayank Kumar
|
|
|
|
|
humm Handling onerasebackground should have solved the problem if i had understood the problem rite...
Flickering is usally caused because of erasing the bk and repainting it...
If you are bitblting the image in OnPaint event how are you doing it?
Can i have the Onpaint code if it is small and simple to understand.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Hi Mr. Prakash,
I am sending u the code of one of the OnPaint function.
The Code is ....
void CDialogSingleConversion::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
//for background image
// CPaintDC dc( this );
CBitmap bmp, *poldbmp;
CDC memdc;
// Load the bitmap resource
bmp.LoadBitmap( IDB_BITMAP_BACKGROUND);
// Create a compatible memory DC
memdc.CreateCompatibleDC( &dc );
// Select the bitmap into the DC
poldbmp = memdc.SelectObject( &bmp );
// Copy (BitBlt) bitmap from memory DC to screen DC
dc.BitBlt( 0, 0, 644, 489, &memdc, 0, 0,SRCCOPY );
memdc.SelectObject( poldbmp );
//background end here
// Do not call CDialog::OnPaint() for painting messages
}
In this code I m just stting the background of the dialog box. I m doing this for each dialog box. Also I am using my own class called CImageButton, to put the images on the buttons. I m sending u the code for the Oninitdialog box for one of the dialog box. The code is::
BOOL CDialogSingleConversion::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
//Code to set the bmp's for the buttons..
m_btnNext.Attach(IDC_BUTTON_NEXT,this,IDB_BITMAP_NEXT,IDB_BITMAP_NEXT);
m_btnBack.Attach(IDOK,this,IDB_BITMAP_BACK,IDB_BITMAP_BACK);
m_btnClose.Attach(IDC_BUTTON_CLOSE,this,IDB_BITMAP_CLOSE,IDB_BITMAP_CLOSE_R);
m_btnMinimize.Attach(IDC_BUTTON_MINIMIZE,this,IDB_BITMAP_MINIMISE,IDB_BITMAP_MINIMISE_R);
m_btnBrowseOutput.Attach(IDC_BUTTON_BROWSEOUTPUT,this,IDB_BITMAP_BROWSE,IDB_BITMAP_BROWSE_R);
m_btnBrowseInput.Attach(IDC_BUTTON_BROWSEINPUT,this,IDB_BITMAP_BROWSE,IDB_BITMAP_BROWSE_R);
CFont *m_Font = new CFont;
m_Font->CreatePointFont(100,"Verdana");
m_Destination.SetFont(m_Font);
m_FileName.SetFont(m_Font);
m_FileSize.SetFont(m_Font);
m_SelectFile.SetFont(m_Font);
CFont *m_Font1 = new CFont;
m_Font1->CreatePointFont(150,"Verdana");
m_Heading.SetFont(m_Font1);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
here m_btnNext etc are the obj of my class CImageButton and they are the member variables of the dialog class. Here I am attaching the bitmaps with the buttons. I m using the bitblt function for applying the BMP's on the buttons.
If u need any other info then plz let me know.
Thanks and Regards
Mayank Kumar
|
|
|
|
|
Firstly is it the flickering of the image or the flickering of the dialog?
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Hi Mr. Prakash
It is the flickering of the dialog Box and I think it is due to the images which i m using for the background and buttons.
thanks and regards
Mayank Kumar
|
|
|
|
|
Its not due to the images, its due to closing and showing the dialogs....
refer David Crow's solution , use propertysheet instead.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Mayank_pumca wrote:
I am simulating the application wizard without using the prperty sheet.
Why? When one dialog is destroyed/hidden and another is created/shown, there is going to be "flicker."
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi Mr. DavidCrow
Do you mean to say that there is no solution of this problem ?
Please reply.
Thanks and Regards
Mayank kumar
|
|
|
|
|
Anonymous wrote:
Do you mean to say that there is no solution of this problem ?
Well, you did not state the reason why you were not using a property sheet in wizard mode. That's the only (easy) solution as I see it.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi Mr. DavidCrow,
I know that property sheet is the best option but I am using dialog box becoz I want to use some background to make my application more attractive. And now I cant switch to the property sheet becaz my application is almost complete and I dont have much time to recreate the application using property sheet. So if u have some solution except property sheet then plz let me know.
Thanks and Regards
Mayank Kumar
|
|
|
|