|
I need to write some unicode text (using ScriptString API) in a dialog window. In main window I would place the drawing stuff in WM_PAINT, but how to deal with dialogs? Do I need to create some owner-drawn element and catch WM_DRAWITEM? If so, which owner-drawn element? I have never created custom controls, hope this won't end up with doing something that challenging.
If you can give also some advice how to make Unicode text's bacground transparent / custom color, if it is possible with a huge amount of work?
Thanks, and try to be as clarify as you can, I have very little WinAPI/ScriptString/Uniscribe/Unicode/whatever experiences.
|
|
|
|
|
i have an assignent to read txt from a file and then remove the extra spaces in the txt. so far i can open the file and display the text. i can't come up with a way of removing the spaces. i have been advised so far to either use strcmp, which i am not sure where that is going to get me, and to 'assign' the individual text to an array and then rejoin the array without the spaces. i firstly don't know how to assign the text to an array. when i try i get an error when compiling saying that i can't convert from 'string' to 'const char*'. can someone please help. i am new so please be gentle.
my code so far:
#include <iostream>
#include <fstream>
#include <string>
using std::cout;
using std::endl;
using std::string;
using std::getline;
int main ()
{
string myStringErrors;
std::ifstream file("Lab1.txt"); //name of orignal file
if (!file)
{
std::cerr<<"Can't open file"<
|
|
|
|
|
use std::string::c_str() to get the C-style string contained in the std::string object
also, please use the <pre></pre> html tags in your messages when you post some code samples in the forum
|
|
|
|
|
i am not sure what you mean by that. how do i use std::string::c_str? what goes in the ()? thanks for the code posting help.
|
|
|
|
|
you put nothing in the parenthesis, this function receives no parameters :
std::string str = "hello";
char* psz = str.c_str();
printf("%s", psz);
|
|
|
|
|
|
zoobiskuit wrote: i can't convert from 'string' to 'const char*'
This is done by using std::string s member-function c_str() , which returns a const char* to the string contained.
You can the go through this const c-string on a char by char basis and copy anything save the extra spaces to another string.
Hope this helps.
P.S.:
"The light at the end of the tunnel is the light of the oncoming train"
or
"Due to the present economic uncertanities, the light at the end of the tunnel will be switched of until further notice"
-- modified at 7:41 Wednesday 24th January, 2007: fixed typo(notive -> notice)
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
jhwurmbach wrote: "Due to the present economic uncertanities, the light at the end of the tunnel will be switched of until further notive"
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Hi,
I need to compile a cpp program using cl.exe
How do i compile a cpp program using cl.exe ?
Thanks.
|
|
|
|
|
you don't need to start a new thread again and again
have you tried to type cl.exe /? in command line to have the syntax ?
and as it might be a bit too huge, have you looked in the msdn ? the information is obviously there
|
|
|
|
|
Can you give the msdn link ?
Thanks.
|
|
|
|
|
|
I thought you would have different ideas .
Thats d reason i asked you that link.
I have seen that link before. Still i need more articles about it.
Thanks.
Nice things do nice works
|
|
|
|
|
what don't you have in it ?
what are you trying to do that it doesn't explain ?
if you don't give us a concrete example, we won't be able to help much
|
|
|
|
|
Sakthiu wrote: How do i compile a cpp program using cl.exe ?
How about:
cl somefile.cpp Obviously this is a very simplistic example. You'll need to add your own compiler switches (as has already been given to you).
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello!!
i have multiple childs in my application.
some calls at click events and some are static.
I want to communicate two child dialog. event created dialog communicate with static dialog
e.g.
suppose i have one child dialog which contian the listview control (static dialog or global dialog).
now when i click on menu item dialog .its create new dynamic dialog which contain combo box.
on the CBN_SELCHANGE event. i open the fileopen dialog and i want to add file in the listview containg dialog(static dialog).
can any body help me?
Thank you
modified at 8:13 Wednesday 24th January, 2007
For that i have written the following code.
POINT point;
point.x=126;
point.y=83;
HWND hwndListboxDlg = ChildWindowFromPoint(GetParent(hDlg),point);
HWND hwndListbox = GetDlgItem(hwndListboxDlg,IDC_LIST4);
LRESULT iCount=ListView_GetItemCount(hwndListbox);
When i debug the application its find the handle for hwndListboxDlg ,but unable to find the
IDC_LIST4.
Amit
-- modified at 8:20 Wednesday 24th January, 2007
|
|
|
|
|
Hello!
I am using the following Function to draw text to a screen:
Status DrawString( const WCHAR *string,
INT length,
const Font *font,
const PointF &origin,
const StringFormat *stringFormat,
const Brush *brush
);
Works fine, but there is one major problem : even if I use PointF(0,0) as origin, the text is displayed with an x-offset (the concrete width in pixel seems to depend on the Font-Object I use within the DrawString - Function).
Any Solution about that? Is this a known bug or even a feature?
Thanks in advance!
-- modified at 6:43 Wednesday 24th January, 2007
|
|
|
|
|
_NielsB wrote: the text is displayed with an x-offset
How much of an x offset?
|
|
|
|
|
As I wrote, it seems to depends on the Font that is in use within the function call.
|
|
|
|
|
i am new to mfc.
i my application i am usind CTime object. i need to store time beyond 1st jan 2038 in that object. I guess CTime object wont be able to store values beyond 1st jan 2038 , so what other options i have ,,, say i want to store year value as 2150.
pls help
Vikram
|
|
|
|
|
Try using COleDateTime instead.
|
|
|
|
|
thanks ... COleDatetime seems to be working fine..
|
|
|
|
|
vikram Verma wrote: i need to store time beyond 1st jan 2038 in that object
As the other guy said use COleDateTime, but do not use COleDateTime::GetCurrentTime...
From MSDN...
COleDateTime::GetCurrentTime. The current implementation calls the C run-time function time, which returns a time_t. This limitation isn't currently documented—it presumably took Chris's digging through the Microsoft Foundation Classes (MFC) source code to find it. (As Dr. GUI says, "Use the source, Luke!") Good job. Don't use this function if you need to be year 2038 compliant. Note also that COleDateTime has a constructor and assignment operator that take a time_t—don't use those either.
A suitable replacement will be GetLocalTime.
|
|
|
|
|
Thanks .... .. for my app COleDatetime Seems to be working fine... But would like to find a better option.
|
|
|
|
|
Hi,
I am working on a project that requires to generate a report after some testing. The report will include some text, one or two pictures and some tables. The dev environment is Visual C++. Did anyone ever work on similar task before? Is there any controls that I can use? Or is there any articles with detailed intro on how to accomplish it?
Thanks a lot!
David
|
|
|
|