|
I'm not exactly sure how the user pictures in Windows work.. But is there a way to find out the path for the current user picture so that it can be drawn into my window's DC? pure c/c++ please!
Thanks for your help!
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
BSoD during a Win98 presentation
|
|
|
|
|
Take a peek in this folder:
C:\Documents and Settings\All Users\Application Data\Microsoft\User Account Pictures
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello all,
I have a small but urgent problem.
I am reading a line of text from a file, that uses delimiters to
separate the text.
For that purpose I am using the strtok function. the problem is that
the text read by strtok when it finds no delimiter is of 1 char size bigger then the value it represents in the IDE.
meaning "John" is displayed as the value name holds but in strlen it shows a size of 5, as opposed to sizeof(name) that shows size of 4.
how does strtok work and why is that please, it's urgent, I have to hand it in
for school tomorow morning at 8:00 and it's now 24:00 here
the relevant code:
while( ! feof(inputFile) )
{
int check;
fgets(Line , 80 , inputFile);
command = strtok(Line , " ");
if(strcmp(command , "add_customer") == 0)
{
int i = 0;
char* name, *address;
int table_num;
if(i == 0)
{
command = strtok(NULL , ";");
name = command;
i++;
}
if(i == 1)
{
command = strtok(NULL , ";");
address = command;
i++;
}
if(i == 2)
{
command = strtok(NULL , ";");
table_num = atoi(command);
i++;
rdb_add_customer(Rest , name , address , table_num);
}
continue;
}
if(strcmp(command , "get_address") == 0)
{
int i = 0;
char* name;
if(i == 0)
{
command = strtok(NULL , ";");
name = command;
i++;
rdb_get_address(Rest , name);
}
continue;
}
//==========================================================================
int string_compare_func(Element e1 , Element e2)
{
int i , j;
if(e1 == NULL || e2 == NULL)
{
if(e1 == NULL && e2 == NULL)
return 0;
else if (e1 == NULL && e2 != NULL)
return -1;
else
return 1;
}
else
{
char* e1S = element_to_string(e1);
char* e2S = element_to_string(e2);
i = strcmp(e1S , e2S);
if(i == 0)
{
i = strlen(e2S);
return 0;
}
else if(strcmp(e1S , e2S) > 0)
{i = strlen(e1S);
i = strlen(e2S);
return 1;}
else {
i = strlen(e1S);
i = strlen(e2S);
j = sizeof(e1S);
j = sizeof(e2S);
return -1;}
}
Please HELPPPP!!!!!!!!!!!!!!
:((
}
|
|
|
|
|
sizeof and strlen are not the same thing. sizeof(e1S) is 4 because e1S is a pointer, and on your CPU, pointers are 4 bytes long.
|
|
|
|
|
Just to add a bit to what Michael said... In the post you made earlier today you had
Element string_to_element(const char* val)
{
Element localElem = malloc(sizeof(val));
strcpy((char*)localElem , val);
return localElem;
}
the sizeof( val ) is returning the size of a char pointer (4) not the length of the string. You would want to use strlen( val ) + 1 like you did in your element_to_string call.
|
|
|
|
|
Hi,
I am trying to develop a DLL which can be used in couple scenarios:
1. Loaded by a console based C++ application, with minimal Win32 code (just to load DLLs)
2. Loaded by a Windows service. This is essentially the C++ Console application converted to a service.
The issue is that I want to handle Windows Messages WM_ based. First of all I do not know whether Message Loops are possible in DLLs. In my mind there are two options:
1. Use SetWindowsHookEx - did not work - possible because the console application itself is not a windows application so does not have a message queue - not sure if my reasoning is correct.
2. Create a window in a separate thread and it may receive messages - but does it work.
So, the fundamental issues are that first I do not know that if this is even possible and second if yes, then how?
if someone can post me some code - better still point me to some authoritative source - it would be great.
Thanks for reading.
|
|
|
|
|
You don't need to have a window, but your message loop does need to run.
You can add an exported entry point to the DLL that when called, starts a thread
that runs a message loop. Note that any windows you want to create that use this message
loop to get their messages must be created on this same thread.
If you create a Win32 GUI application with the app wizard and examine the _tWinMain()
function, your thread proc in the DLL would be very similar - register any window class you
initially need, create any initial window you need, and finally, loop translating and dispatching
messages until some termination event occurs.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi-
When I open my projects and try to access the Project Property pages, the Configuration Properties window on the left is there (and browses down correctly) but the right-hand side is just a blank gray box- no grid to let me see or modify my properties.
- Happens on all my projects
- I have not used the dialogs in a long time as I have not been making those types of changes
- The projects build correctly (so the data is there and accessed correctly)
- I can see the data in the .vcproj file
- I tried updating VC++ and got one patch, but no effect
- I found one other reference to this problem (back in 2004 But no solution was given.
Can anyone help?
Thanks!
Markd
|
|
|
|
|
Hi,
Is it possible to use LPSTR_TEXTCALLBACK for some subitems in a CListCtrl control
or must it be used for every subitem ?
|
|
|
|
|
Have you tried it? I haven't....I was hoping you would try it and report
back to us with the results
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
LPSTR_TEXTCALLBACK only affects one item/subitem at a time
|
|
|
|
|
Me view is derived from CFormView.
I need to add dialog in my view like a fixed child window. I do this in OnCreate.
m_TableDialog.Create(IDD_DIALOGTABLE, this);
The problem: The m_TableDialog doesn't receive messages, but controls in it do. So, for example CMyView::OnLButtonDown never called. What's the problem?
-- modified at 1:02 Sunday 9th September, 2007
|
|
|
|
|
progDes wrote: The problem: The m_TableDialog doesn't receive messages, but controls in it do. So, for example CMyView::OnLButtonDown never called.
I'm confused. m_TaleDialog is a CMyView class object? The WM_LBUTTONDOWN message
should go to the window under the cursor unless the mouse is captured by another window.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
No, m_TableDialog is CDialogTable object. And the dialog is creating in CMyView::Create. The owner of m_TableDialog is a view class. May be the creation of dialog is wrong? Looks like some modal dialog catch all messages.
|
|
|
|
|
Again, the WM_LBUTTONDOWN message should go to the window under the cursor
unless the mouse is captured by another window.
Where are you clicking and where do you expect to get the message?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm clicking on dialog window, and waiting the message in CDialogTable::OnLMouseDown.
The strange thing:
Controls are acting correct, buttons are animating etc, but there is a beep sound when I'm selecting element in CListCtrl (just like, trying to do something when modal dialog on the top), bu elements are selecting correctly.
|
|
|
|
|
I'm not picturing how your windows are arranged so it's tough to tell
what's going on.
Your CDialogTable is a child of a CFormView, right?
If so, it's on top of its parent in the z-order. How much of its parent is it covering up?
What controls are on which windows?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
SOLVED
This is long to explain, but in general I'm a fool myself
|
|
|
|
|
whith the GDI+ method DrawImage(), i can display a normal size image, but i can't display an image with 400M size. is there size limit and how can i display a big size image? thanks.
|
|
|
|
|
Where did you get an image of that magnitude? I can't say I've ever tried to display one that large.
Some suggestions would be to not use interpolation to see if it renders. If your using something like InterpolationModeHighQualityBicubic you might be asking too much of the graphics object.
Did you try rendering a much smaller image using the same code to see if it's displaying it in a part of your coordinate system that is visible. You might be rendering it in negative coordinates or somewhere off the client area.
Does the large image display with other rendering programs like MS Photoeditor or something similar that will scale it to fit the screen?
Try to eliminate those possibilities first if you haven't already.
|
|
|
|
|
Another thing I forgot to add is to ask if the image isn't rendering but the app is responsive, or does it seem locked up and not responding?
The reason for my question is that I've noticed for compression/decompression using a well known library like zlib, if the file image is excessively large, the decompression routine can take a very long time to finish. If the file format uses advanced compression schemes, the code probably will perform, performance-wise, similar to zlib since it's probably about as efficient as they come (within reason).;)
If it seems to hang, it might not be done decompressing yet. I found myself blaming MSXML for taking a long time to load/save very large xml files only to realize that it was the decompression/compression stages I had inserted between the DOM parser and the file that were taking so long. Even changing the cache sizes had minimal effect on the time required for processing so I'm guessing it's inherent in what the compression algorithm does that starts to bog down with excessively large files.
Just an idea.
|
|
|
|
|
well is this a higher res image(may be for print purposes) or just plain old large (like maps). Here are some ideas depending on the anser:
1. if the image is high res image such as 1200, 2400 dpi letter size rgb image, downsample the image first . Because, displaying that image (fitting the screen) full res is asking the graphics subsystem to downsample it on the fly. Image quality will not suffer (assuming you downsample it right). Do not over do it allowing the viewer zoom in say up to 300%. So even down to 300dpi will bring file size down to 1/16 allowing your self zoom in roughly about 300% without quality problems.
2. if the image is lower res (300 dpi or less), but large. most likely scenario you will not display it fitting the screen. Because it will look horrible, even if displaying was possible. In that case extract a region and display only that depending on the scroll position.
I hope this gives you some ideas.
|
|
|
|
|
thanks Teashirt2.
the image i want to display is 300dpi , 400M letter size RGB. as your suggestion, i can display it in an extract region. but i still want to display it in the whole view client. and my view is derived from ScrollView, but still can not display it.
|
|
|
|
|
help:
first i draw a white circle using opengl, and then i loaded an image as texture and display the texture, but i was confused that the circle color was changed into the some color as the texture's! what is wrong with it?
thanks.
|
|
|
|
|
Lao Wang wrote: first i draw a white circle using opengl, and then i loaded an image as texture and display the texture, but i was confused that the circle color was changed into the some color as the texture's! what is wrong with it?
In opengl textures cannot display by themselves, they have to be pasted onto something, since your circle was the only thing there, you pasted it onto that. By turning on and off texturing at the appropriate times, you can have multiple objects with a texture each.
http://nehe.gamedev.net/lesson.asp?index=02[^]
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|