|
|
nehathoma wrote:
Went for my Project Viva to College
suhredayan There is no spoon.
|
|
|
|
|
I'll assume you mean an unsigned character string.
1) A string (by default) is a signed character array ending with a null character ('\0').
2) "string" is of type (char*).
3) To treat a string as an unsigned character string:
char* pStr = "string";
unsigned char* puStr = (unsigned char*)pStr;
3) To convert and individule character (in a string) from signed to unsigned:
unsigned char uch = (unsigned char)pStr[i];
That's all there is to it.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi,
I have an application (in VC++ 6.0) wherein it displays the images in ListView. So the application starts displaying the images from the Top left corner (0,0).
Now I have added the manifest file (to give XP look to application) in applicatoin resource successfully. (as outlined in the below mentioned link http://www.codeguru.com/Cpp/controls/controls/article.php/c5227/[^])
The application is having the XP look but the images are displayed from the Bottom left corner.
Question:How to set the origin of the ListCtrl to top left corner (0,0) so that the images are displayed from the top left corner (0,0) ?
Thanks & Regards,
Neeraj
Thanks & Regards,
Neeraj
|
|
|
|
|
hi
I have problem in setting the link to the lable having the text .
or is there any way i can set the link to the text and open the explorer for that url.
Need it urgent.waiting for reply as soon as possible
Best Regards
ganesh
|
|
|
|
|
|
Man are you in the wrong place!
Links to 'lable'?
This forum is for much lower level programmers than you; in other words, people who make code that makes your code work.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
hi..
i m not angry with your reply but for your kind information you should not reply such things if you don't like just ignore..
thanx..
xyz
|
|
|
|
|
Does any one have a set of REs that will give an RE-parser a good workout?
Prefered:
A set of REs and a set of test strings, to varify them.
Thanks, all!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Just search on the web for tutorials on regular expressions, you can even limit it to well-known programs like perl, sed, awk, etc...
Check out The Regulator. It's a free regular expression tester and more, it's written in .NET, source code is available too.
|
|
|
|
|
Surely 'written in .NET' is only a bonus if the guy is going to be using .NET ?
I did a rentacoder job to deliver some regexes, and when I did, they didn't test them in the tool they were going to use them in ( written in C# ). No, they used a C++ program with it's own regex flavour. Then they complained that the regexes didn't work. idiots.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Ahhhh! I'm right here!
I am looking for REs to test my parser, written in C/C++, not the one that comes with .NET.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
:-DThanks! That is a new one that I've not seen.
Tutorials are great, but I'm not looking for how to use REs. I am looking for test REs to verify that my RE parcer works.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I Solved this Problem, Thankyou
|
|
|
|
|
Learn to program without the wizard, it will make you a much better coder.
I'm not sure this is what you want though, I thought there was an overall setting for controls to send messages to their parent, or is that just in C# ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thanks a ot for your answer and advise
I'm sorry to reply so late, but I was completely very busy!
I should tell you I found the answer my self just some minutes
after I put the message, I had to remove the message, sorry!
The answer was to derive a class from CButton , and then change
Button to BitmapButton my self!!!
How ever CBitmapButton is not listed in 'New Class' window,But it is
supported.
Any way thanks alot.
|
|
|
|
|
The answer is still to learn how to write a class without using a wizard.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Since I was programming in Turbo C++ for 2 years, I guss I know how to write a class without the Helps of the Wizard.
How ever in MFC it could make a life more easier.
|
|
|
|
|
What is the MFC 6.0 equivalent of the dir.h calls
_findfirst, _finddata, etc.
They don't work so well any more.
|
|
|
|
|
|
_findfirst is in io.h! I don't know what dir.h is!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi Guys,
I am using a Dialog resource template to create a dialog and load that dialog using the function
DialogBox(hMod, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
The WndProc is like this, What i am trying to do here is to load all the BMP files one by one in to a window when the user clicks the button 'Next' or 'Previous'.
I Tried different techniques, but when i click next the Window is not repainted. The cod for the WndProc is shown below
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int i = 0;
int nPos = 0;
switch (message)
{
//HDC hDC, MemDCExercising;
//PAINTSTRUCT Ps;
//HBITMAP bmpExercising;
//HWND ctrl, hwndItem;
//RECT rect;
char szDirectory[256];
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
case WM_INITDIALOG:
GetCurrentDirectory(256, szDirectory);
sprintf(szDirectory,"%s\\debug\\*.bmp",szDirectory);
//finding the first file
hFind = FindFirstFile(szDirectory, &FindFileData);
if (hFind != INVALID_HANDLE_VALUE) {
sprintf(allFiles[i++],"%s", FindFileData.cFileName);
//Finding all the bmp files
while(FindNextFile (hFind,&FindFileData)) {
sprintf(allFiles[i++],"%s", FindFileData.cFileName);
}
totalFiles = i; //Total bmp files
} else { //if there are no BMP files then disable all bot h buttons
//EnableWindow(GetDlgItem(hDlg, IDC_PREVIOUS_IMAGE), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_NEXT_IMAGE), FALSE);
}
EnableWindow(GetDlgItem(hDlg, IDC_PREVIOUS_IMAGE), FALSE);
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
if (LOWORD(wParam) == IDC_NEXT_IMAGE) {
currentFile ++;
EnableWindow(GetDlgItem(hDlg, IDC_PREVIOUS_IMAGE), TRUE);
//RedrawWindow(hDlg, NULL, NULL, RDW_ERASE);
//InvalidateRect (GetDlgItem(hDlg, IDC_CANVAS), NULL, FALSE);
if(currentFile>=totalFiles-1) { //if all the files has been viewed then disable next button
EnableWindow(GetDlgItem(hDlg, IDC_NEXT_IMAGE), FALSE);
}
//hwndItem = (HWND) GetDlgItem(hDlg,IDC_CANVAS);
//repaintWindow(hDlg);
//nPos = SendMessage( hDlg, WM_PAINT, 0, 0 );
//InvalidateRect (hDlg, NULL, TRUE);
UpdateWindow (hDlg);
//RedrawWindow(hDlg, NULL, NULL, RDW_INTERNALPAINT);
}
if (LOWORD(wParam) == IDC_PREVIOUS_IMAGE) {
currentFile --;
EnableWindow(GetDlgItem(hDlg, IDC_NEXT_IMAGE), TRUE);
//RedrawWindow(hDlg, NULL, NULL, RDW_ERASE);
//InvalidateRect (GetDlgItem(hDlg, IDC_CANVAS), NULL, FALSE);
if(currentFile<=0) { //if all the files has been viewed then disable next button
currentFile = 0;
EnableWindow(GetDlgItem(hDlg, IDC_PREVIOUS_IMAGE), FALSE);
}
//hwndItem = (HWND) GetDlgItem(hDlg,IDC_CANVAS);
//repaintWindow(hDlg);
//nPos = SendMessage( hDlg, WM_PAINT, 0, 0 );
//InvalidateRect (hDlg, NULL, TRUE);
//RedrawWindow(hDlg, NULL, NULL, RDW_INTERNALPAINT);
UpdateWindow (hDlg);
}
return TRUE;
break;
case WM_DESTROY:
PostQuitMessage (WM_QUIT);
break;
case WM_PAINT:
/*ctrl = GetDlgItem(hDlg, IDC_CANVAS);
hDC = BeginPaint(ctrl, &Ps);
// Load the bitmap from the resource
//bmpExercising = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP1));
//Load bitmap from a file
bmpExercising = (HBITMAP)LoadImage(
hInst, // handle to instance
allFiles[currentFile], // image to load
IMAGE_BITMAP, // image type
0, // desired width
0, // desired height
LR_LOADFROMFILE// load options
);
//GetBitmapDimensionEx (bmpExercising, bmpSize);
// Create a memory device compatible with the above DC variable
MemDCExercising = CreateCompatibleDC(hDC);
// Select the new bitmap
SelectObject(MemDCExercising, bmpExercising);
GetWindowRect(ctrl,&rect); // Copy the bits from the memory DC into the current dc
StretchBlt(hDC, 0, 0, rect.right - rect.left,
rect.bottom - rect.top,
MemDCExercising, 0, 0,200,
200, SRCCOPY);
// Restore the old bitmap
DeleteDC(MemDCExercising);
DeleteObject(bmpExercising);
EndPaint(ctrl, &Ps);
//UpdateWindow(GetDlgItem(hwnd, IDD_DIALOG_BOX));
//return FALSE;
*/
repaintWindow(hDlg);
break;
//Initilize the dialog
//default:
// return DefWindowProc(hDlg, message, wParam, lParam);
}
return FALSE;
}
void repaintWindow (HWND hDlg) {
HDC hDC, MemDCExercising;
PAINTSTRUCT Ps;
HBITMAP bmpExercising;
HWND ctrl;//, hwndItem;
RECT rect;
ctrl = GetDlgItem(hDlg, IDC_CANVAS);
hDC = BeginPaint(ctrl, &Ps);
// Load the bitmap from the resource
//bmpExercising = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP1));
//Load bitmap from a file
bmpExercising = (HBITMAP)LoadImage(
hInst, // handle to instance
allFiles[currentFile], // image to load
IMAGE_BITMAP, // image type
0, // desired width
0, // desired height
LR_LOADFROMFILE// load options
);
//GetBitmapDimensionEx (bmpExercising, bmpSize);
// Create a memory device compatible with the above DC variable
MemDCExercising = CreateCompatibleDC(hDC);
// Select the new bitmap
SelectObject(MemDCExercising, bmpExercising);
GetWindowRect(ctrl,&rect); // Copy the bits from the memory DC into the current dc
StretchBlt(hDC, 0, 0, rect.right - rect.left,
rect.bottom - rect.top,
MemDCExercising, 0, 0,200,
200, SRCCOPY);
// Restore the old bitmap
DeleteDC(MemDCExercising);
DeleteObject(bmpExercising);
EndPaint(ctrl, &Ps);
//UpdateWindow(GetDlgItem(hwnd, IDD_DIALOG_BOX));
//return FALSE;
}
Please help me.
Thanking in Advance,
Jobby
|
|
|
|
|
(FIRST) I am getting used to seeing stuff like this, but it does not change the fact that it should not compile:
switch (message)
{
char szDirectory[256];
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
...
...
}
(SECOND) I'm too tired for this right now!
(THIRD) Ask me how; when I'm asleep (It's that simple).
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Thanks Mr.Shaw, but that dosen't help....
|
|
|
|
|
Don't bother, i fixed the problem.
|
|
|
|
|