|
Well I don't want to print the characters out, they are just being used as a one byte representation so I can send that byte across a usb line and then do the opposite conversion, char to int to decimal. etc...
For some reason when I've done this before.. I dont get the right symbol.. or maybe I am..
In the debugger in VC++ the value shows up in its hex value and then it also shows the actually char.. and for the ones that I thought it wasn't working it was showing that weird square character....
Am I just stupid and its doing the conversion right its just not showing it for whatever reason? (ie cuz its a nonprinting). It also happened for a couple of values around the middle of 0-255 at about 128.. That's totally a printable character.. So I dunno.
|
|
|
|
|
You only have to worry about the hex value. What the displayed character looks like depends on glyph the current font uses to display it. The square just means the current font does not have a glyph associated with that ascii character.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I posted a question yesterday, but I never got any answers. The original question was about resizing a grid when double-clicked on. I got that part working, but the grid is still not redrawing correctly... There are other controls on the CFormView that the grid is covering when it's resized (like it's supposed to), but these controls are still showing through the grid until I actually move a scrollbar, then the grid is on top correctly. I tried RedrawWindow(),Invalidate(),InvalidateRect(), and even SetWindowPos() with &wndTopMost, and it still shows the other textboxes through the grid when it's resized. When my grid is resized to fill the entire form I don't want any other controls to be visible until they double-click it again. Any help?
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
I suggest hiding the other controls. It should be a simple case of calling ShowWindow(SW_HIDE) on them. You can use GetWindow(GW_NEXT) to find the other controls.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
that's what I ended up doing. I used EnumChildWindows() with this function:
BOOL __stdcall MyHideWindow(HWND hwnd, LPARAM lparam)
{
BOOL* pbVisible = (BOOL*)lparam;
CWnd *pWnd = CWnd::FromHandle(hwnd);
int nCurrentID = pWnd->GetDlgCtrlID();
if(nCurrentID != IDC_PROJECT && nCurrentID != IDC_PROJECTSTATIC &&
nCurrentID != IDC_VIEWSTATIC && nCurrentID != IDC_FILTER &&
nCurrentID != IDC_CUSTOM1 && nCurrentID != IDC_TEST)
{
int nCmdShow = (*pbVisible ? SW_SHOW : SW_HIDE);
pWnd->ShowWindow(nCmdShow);
}
return TRUE;
}
then send it in a true or a false for which one I want to do, leaving certain controls alone.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
I need to play a WAV file when a push button is pressed, I did try the Wave Class for Playing and Recording Wave Files class on this site but complained about the my WAVs being invalid format.
Any simple examples out there that work for VS 7.1
Many thanks.
grahamfff
|
|
|
|
|
PlaySound[^]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
At the very least, make sure PlaySound can play your WAV files.
Maybe they ARE in an invalid format, or you are not setting up the format information correctly prior to using the WAV play class.
|
|
|
|
|
I have a problem with the free instruction under win32, t raise an error when i try to free allocated memory after i allocated it with malloc, i don't know why, if the MSDN indicates that is right.
The code i use is some like this:
LPSTR lpCode=(char *)malloc(MAX_PATH);
strcpy(lpCode,lpText);
SendMessage(GetDlgItem(hMain,IDE_RTFBOX),WM_SETTEXT,NULL,(LPARAM)lpText);
free(lpText);
|
|
|
|
|
I have no idee why you're allocating memory for a variable you don't use, but when you use malloc on lpCode you should use free on lpCode too. Not on lpText, which is a totaly different variable...
Wout Louwers
|
|
|
|
|
Excuse me i forgot these lines:
char lpText[]="Hello world";
...
free(lpCode);
When i free the memory allocated in lpCodeit raise an error
The first example code was wrong excuse me.
|
|
|
|
|
But the line
free(lpText);
does that exists in your code? Beacause that line is wrong. Please try your code without that line...
Wout Louwers
|
|
|
|
|
You should try
lpText=(char*)malloc(32);
strcpy(lpText,"Hello world\n");
...
free(lpCode);
free(lpText);
|
|
|
|
|
SendMessage is synchronous. It's perfectly OK to use lpText as the parameter. SendMessage will not return until the receiving window has handled the message.
If you wrote the control with ID IDE_RTFBOX , and overrode WM_SETTEXT , you should make a copy of the argument there.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
|
Anyone know how to turn it off from a WinInet-based client?
I'm getting hit by Q263754: WinInet Application Stops Responding and Shows 100-Percent CPU Utilization[^]. The problem only occurs when chunked encoding is enabled.
They recommend that you use HTTP 1.0, which doesn't support chunked encoding, except that specifying HTTP 1.0 in the request doesn't fscking work!!![^]
Their recommendation is to change a setting in the registry to force IE/WinInet to use HTTP 1.0. It would, of course, be extremely poor form for my application to do this so is there anything else I can do?
I tried setting a "Transfer-Encoding: identity" header in my request but that causes the HttpSendRequest() call to hang
Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin
Awasu 2.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
I have a proplem when I insert data into a binary field of table.
I use ODBC and MFC.
thank you very much.
|
|
|
|
|
In my quest for a simple to use image loading library I came across GDI+. I only want to use the portion of GDI+ that loads images, since it loads every image type that I would ever need into a DIB (which I can extract and feed OpenGL). However, I have the most annoying and frustrating issue: the image is not loaded and the lastResult member of the Bitmap object indicates InvalidParameter. Obviously I'm feeding it something bad. The relevant code snippet follows:
<br />
xBoolean xImage::Load (char *fileName, xBoolean mipmap)<br />
{<br />
BitmapData *bmpData = new BitmapData ();<br />
Rect *rect = new Rect ();<br />
sint32 format, stride;<br />
uint32 i, j;<br />
xbyte *tempBuffer;<br />
uint32 wideLen;<br />
WCHAR *fileNameW = NULL;<br />
<br />
if (fileName == NULL)
return xfalse;<br />
<br />
wideLen = MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, fileName, -1, NULL, 0);
fileNameW = (WCHAR *)malloc (wideLen);
MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, fileName, -1, fileNameW, wideLen);
<br />
Bitmap bmp ((const WCHAR *)fileNameW, FALSE);<br />
<br />
...<br />
The string fileName is being properly translated to fileNameW as below:
<br />
fileName[0] 119 'w' char<br />
fileName[1] 104 'h' char<br />
fileName[2] 105 'i' char<br />
fileName[3] 116 't' char<br />
fileName[4] 101 'e' char<br />
fileName[5] 46 '.' char<br />
fileName[6] 116 't' char<br />
fileName[7] 103 'g' char<br />
fileName[8] 97 'a' char<br />
fileName[9] 0 char<br />
<br />
fileNameW[0] 119 unsigned short<br />
fileNameW[1] 104 unsigned short<br />
fileNameW[2] 105 unsigned short<br />
fileNameW[3] 116 unsigned short<br />
fileNameW[4] 101 unsigned short<br />
fileNameW[5] 46 unsigned short<br />
fileNameW[6] 116 unsigned short<br />
fileNameW[7] 103 unsigned short<br />
fileNameW[8] 97 unsigned short<br />
fileNameW[9] 0 unsigned short<br />
The constructor for the Bitmap object is as follows:
<br />
class Bitmap : public Image<br />
{<br />
public:<br />
friend class Image;<br />
friend class CachedBitmap;<br />
<br />
Bitmap(<br />
IN const WCHAR *filename,<br />
IN BOOL useEmbeddedColorManagement = FALSE<br />
);<br />
Recall that the lastResult member is being set to InvalidParameter. Here are the possible GDI+ return values:
<br />
enum Status<br />
{<br />
Ok = 0,<br />
GenericError = 1,<br />
InvalidParameter = 2,<br />
OutOfMemory = 3,<br />
ObjectBusy = 4,<br />
InsufficientBuffer = 5,<br />
NotImplemented = 6,<br />
Win32Error = 7,<br />
WrongState = 8,<br />
Aborted = 9,<br />
FileNotFound = 10,<br />
ValueOverflow = 11,<br />
AccessDenied = 12,<br />
UnknownImageFormat = 13,<br />
FontFamilyNotFound = 14,<br />
FontStyleNotFound = 15,<br />
NotTrueTypeFont = 16,<br />
UnsupportedGdiplusVersion = 17,<br />
GdiplusNotInitialized = 18,<br />
PropertyNotFound = 19,<br />
PropertyNotSupported = 20<br />
};<br />
It isn't that it can't find the file, GDI+ is initialized properly, and it isn't any useful error. One other thing, if I change the line
<br />
Bitmap bmp ((const WCHAR *)fileNameW, FALSE);<br />
to read
<br />
Bitmap *bmp = new Bitmap ((const WCHAR *)fileNameW, FALSE);<br />
the compiler spits an error about not finding the constructor, which I found odd. If anyone can help, it would be much appreciated.
|
|
|
|
|
jgeorge21 wrote:
fileName[5] 46 '.' char
fileName[6] 116 't' char
fileName[7] 103 'g' char
fileName[8] 97 'a' char
From MSDN:
[quote]
Bitmap::Bitmap(filename, useIcm)
Creates a Bitmap object based on an image file.
Bitmap(
const WCHAR* filename,
BOOL useIcm
);
Parameters
filename
[in] Pointer to a null-terminated string that specifies the path name of the image file. The graphics file formats supported by GDI+ are BMP, GIF, JPEG, PNG, TIFF, Exif, WMF, and EMF.
[/quote]
I do not see tga in the list of supported formats.
Try http://www.codeproject.com/bitmap/cximage.asp[^] instead.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
hello
This is meant as a theorethical programming question basically but if you could acompany some examples in c and vbs to your answers as examples or proof of concepts that would be lovely.
So the question is:
Can code be archived(made smaller than it actually is)?
Like for exemple could I have a function make_code_big_again that could receive as a parameter a array like structure, string wharever containing some code that was made small andmake it bigg again and run it???
or could this be done with binary files???
like could I somehow archive them, put them inside the exe in a big string or as resources and then unpack them, but withouth utilising any third paryt software like winrar or winzip cause that wouldn't make the program very platform independent.
???
thank you for your time
|
|
|
|
|
Sure, if the code is run on an interpreter.
|
|
|
|
|
something like an auto-extractable zip archive ? yes it's possible...
I think that you can find an example somewhere here on codeproject.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
how to create thread in runtime
|
|
|
|
|
UINT thFun(void*){
return 0;
}
fun(){
AfxBeginThread(thFun,NULL); //starts thFun() in a new thread
return 0;
}
This creats a worker thread. There is something called UI thread also-
search cp for them ...
suhredayan There is no spoon.
|
|
|
|