|
try setting the background brush of the dialog box by usning the setclasslong method use GCL_HBRBACKGROUND as the index in the api.
|
|
|
|
|
Hi!
I have a problem with setting the character set in my ListBox (List). When I create a CFont object with a specific character set and I set that font in the Device Context recieved from the ListBox, then it is OK. I can write through that DC in the chosen charset. See Code :
CFont * font = new CFont;
CFont *oldFont;
CPaintDC dc( List );
font->CreateFont (28,0,0,0,700,0,0,0,
RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH|FF_DONTCARE, "Arial");
oldFont = dc.SelectObject( font);
dc.ExtTextOut(10,170,0,NULL,"some text",
strlen("some text"),NULL);
!!!!!!!!! BUT !!!!!!!!!
If I set that font right in my ListBox and want to have the text added with code :
<br />
List->SetFont( font, TRUE); <br />
List->AddString( "some other text" ); <br />
in the chosen charset, then it DOES NOT work !
However the added text has the other parameters of the chosen font ( Height and so on) but the charset is the original (standard) one
Does anyone know how to force the ListBox to accept the charset from the font also ? Or it might be a bug in my Visual Studio ?
PLEASE HELP!
|
|
|
|
|
I have been trying to have an Edit Box take the Tab key as a simple move off the control - just tab around all the controls with Tabstop set.
Currently the Tab acts as an end to data input (i.e. like a Return or Enter key pressed). I did start to Derive the Edit Box control, but got stuck, see code below!
<br />
#include "stdafx.h"<br />
#include "MyEdit.h"<br />
<br />
<br />
<br />
IMPLEMENT_DYNAMIC(CMyEdit, CEdit)<br />
CMyEdit::CMyEdit()<br />
{<br />
}<br />
<br />
CMyEdit::~CMyEdit()<br />
{<br />
}<br />
<br />
BEGIN_MESSAGE_MAP(CMyEdit, CEdit)<br />
ON_WM_GETDLGCODE() <br />
END_MESSAGE_MAP()<br />
<br />
<br />
<br />
UINT CMyEdit::OnGetDlgCode()<br />
{<br />
return DLGC_WANTTAB;<br />
}
Currently the Edit Box (MyEdit) only processes the TAB key, I want it to process all keys but with the Tab key just move on to the next tabstop.
Help!
grahamfff
|
|
|
|
|
Lookin' for a l'il help here.
How do you launch a file from within a compiled C++ project?
I'd like my file to have a Switch where Case 1 is print this picture on the screen, Case 2 is leave program and launch a:\screensaver.exe
Is such a thing possible?
Thx
". . .gonna keep on tryin' - til I reach my highest ground"
|
|
|
|
|
This will activate the currently selected screensaver:
BOOL bScreenSaverEnabled = FALSE;
BOOL bStatus = ::SystemParametersInfo
(SPI_GETSCREENSAVEACTIVE, 0, &bScreenSaverEnabled, 0);
if (bStatus && bScreenSaverEnabled)
AfxGetMainWnd()->SendMessage (WM_SYSCOMMAND, SC_SCREENSAVE);
[edit]
Ooops, I just re-read your post. Use CreateProcess() to execute an app from within your app.
[/edit]
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
Thanks Mike - I think I'll punt and go with WinExec().
If these are the last lines of my code:
////////////////////////
return; // return from next to last function
}
if (QuizAvg>0.79)
{
WinExec (“a:\ballfusion.exe”, SW_SHOWNORMAL );
}
Cout<< “Sorry – your score was less than 80%.”;
Clearscreen();
}
Return 0; // end of Main()
}
Do my B+ students get the executable screen saver no matter what (in a desktop setting) and my C students get the "sorry message"?
Where would the program finalize and is there good form for ending such a program that "tosses off" to another application (destructors, clearing mrmory and the like)? Thanks!
|
|
|
|
|
You need an else block there, as it is now the "sorry" message will be printed all the time.
THe original program does not end after WinExec() , you need to do cleanup in the same way as when you don't call WinExec() .
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
I even hear the Windows "OMG I booted up fine" sound.
-- Paul Watson diagnosing hardware problems.
|
|
|
|
|
thanks Mike - I re-read your tutorial. Some would have you avoid WinExec, but I'm a beginner and need "EZ".
So--- I follow the need for Else, I'll reverse the order so "C" students are handled first, and close out open classes & pointers prior to the IF-ELSE. But if the screensaver returns to C++ code and finds itself at a "return 0;" at the end of Main(), why won't my program end itself?
Appreciate it!
". . .gonna keep on tryin' - til I reach my highest ground"
|
|
|
|
|
hi,
is there any way so i can print a report created in MSACCESS database through a VC++ code suppose that the report name is "report1" and it is in a database called "db1.mdb",waiting for help, thanks
|
|
|
|
|
i am working with a directsound program. i need IDirectNotify to place some notification when playing sound. but i found that i can't get it through the function-QueryInterface. it always fails. please help me. thanks
laia.
|
|
|
|
|
HRESULT SetStopNotification(HANDLE hMyEvent,
LPDIRECTSOUNDBUFFER8 lpDsbSecondary)
{
LPDIRECTSOUNDNOTIFY8 lpDsNotify;
DSBPOSITIONNOTIFY PositionNotify;
HRESULT hr;
if (SUCCEEDED(
hr = lpDsbSecondary->QueryInterface(IID_IDirectSoundNotify8,
(LPVOID*)&lpDsNotify)))
{
PositionNotify.dwOffset = DSBPN_OFFSETSTOP;
PositionNotify.hEventNotify = hMyEvent;
hr = lpDsNotify->SetNotificationPositions(1, &PositionNotify);
lpDsNotify->Release();
}
return hr;
}
Don't try it, just do it!
|
|
|
|
|
I just use these codes to get it, but the QueryInterface always failed. Then I try to get the interface to the CaptureBuffer, it is ok. Why these happened?
laia
|
|
|
|
|
I am programming with unicode.And I don't know how to send a character with the code > 0xFF.Anyone know it.
Thank you very much...
|
|
|
|
|
Hi,
I don't know what do you mean with "...how to send a character..." but if what you want is assign a UNICODE character to a variable, this is how
TCHAR c = 0x0100;
Now if you are talking about UNICODE strings, use BSTR or one of the classes that encapsulate it, CComBSTR or _bstr_t.
Fabian
|
|
|
|
|
Sorry for my ambiguous question.I want to send a message WM_CHAR with a code > 0xFF but when I use the following code :
wParam = 0x01ff
It send a character with code = 0xff.
|
|
|
|
|
Hi,
Could you be more specific?
If I do this
TCHAR t = 0x01FF;
SendMessage(WM_CHAR, (WPARAM)t, NULL);
when I process the message I get wParam == 0x000001FF
Fabian
|
|
|
|
|
Silly question, but do you have _UNICODE and UNICODE defined? If you don't, TCHAR will equate to char..... and:
TCHAR t = 0x01FF;
SendMessage(WM_CHAR, (WPARAM)t, NULL);
Will truncate t to 0xFF when stored in a char varible.
Try being explicte about what character set you are sending -
wchar_t t = 0x01FF;
SendMessage(WM_CHAR, (WPARAM)t, NULL);
|
|
|
|
|
Hi All,
I'm trying print a bitmap but the print preview works well, the bitmap appears nolmaly but when I print, the bitmap don't appears. I'm using a MFC MDI project and the OnBeginPrinting and OnPrint.
All other elements in the printed sheet appears normaly.
Thanks in advance
Sergio Batarce
|
|
|
|
|
|
Soon after I had put this question, I find your article. It is helping me too mutch. Thank you very much
|
|
|
|
|
Hi all.
I am using a class found here http://www.codeproject.com/database/cspreadsheet.asp to create an excel spreadsheet ( i believe it uses ODBC )
It works great except I cannot, from my code, get the cells to autofit. That is, when you load up the file in Excel, a lot of the contents of the cells get cut off, because the cell is not big enough. I need to be able to tell it to autofit (automatically through code) or be able to specify the width of each column of cells. If I bring up the file in excel, and select all of the cells, then click on Column->Autofit, it makes it look right instantly ... However, I am planning on rolling out a program that generates reports and I don't want to have to tell the users that they have to do this every time they open a report.
Any help in the right direction would be appreciated!
-Shultas
|
|
|
|
|
Hi
ODBC, ADO or OLEDB will only allow you to manipulate data in and out Excel files, to go beyond that, you should use Automation, then you will be able to do, programmatically, anything you have to do.
You can take a look here to start, SAMPLE: XLCLIENT: Automation Client for Excel, also search the MSDN for more info.
Fabian
|
|
|
|
|
Hi
I am now on stage to integrate the HTMLHelp build with HTML Workshop >> Help.chm
In my project i had included the htmlhelp.h file and also the library htmlhelp.lib (both taken from HTML Help Workshop folder).
Now what to do?
Where to call the initialise or state that this is the html help file which has to be linked with teh project?
WHere to use following API i.eHTMLHelp?
HtmlHelp();
Urgent, Please help me in this respect?
Sandeep
Leave your mark wherever you go
|
|
|
|
|
Help topics are usually linked to different elements (dialogs, views) of your app. Here's what I do (which is slightly different from MS' process):
For every dialog (eg: CMyDialog ), define a unique constant (eg: Help_MyDialog ). Keep these constants in the file MyAppHelp.h . Include this file as a map in your HtmlHelp project. Ids in the file will map to your .chm 's topic ids.
Add a "Help" button to your dialog. It's handler should execute this:
HWND hWndHelp = HtmlHelp (NULL, strHelpFile, HH_HELP_CONTEXT, Help_MyDialog); where strHelpFile is the full path to your app's .chm file.
Add a handler for the WM_HELPINFO message. This message is sent whent the user clicks the F1 key. In its handler, just call your Help button handler.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|