|
I was desparetly searching but couldn't find any splashscreen, tip of the day dialog, progress dialog etc. there. That is what I meant under "ready-made components".
Surely it is my fault.
|
|
|
|
|
I know what you want and I can't find them either. I presume they have gone.
Dave.
|
|
|
|
|
for example:
in DOS program:
sruct a
{
char b;
word c;
}
sizeof(a)=3
but in vc++:
sizeof(a)=1+1+2=4;
why?who can tell me?
thanks a lot!
-----------------------------
Mr.Whelk
-----------------------------
Zhuhai City ,Guangdong ,China
|
|
|
|
|
It's an optimization technique for optimizing memory access (commes from HW architecture).
Pavel
Sonork 100.15206
|
|
|
|
|
thanks
-----------------------------
Mr.Whelk
-----------------------------
Zhuhai City ,Guangdong ,China
|
|
|
|
|
If your struct is not aligned you need more RAM accesses that is necessary to read or store it.
Try this[^] or this[^]
Pavel
Sonork 100.15206
|
|
|
|
|
You can use #pragma pack to change the structure alignment, if it's required for compatibility.
|
|
|
|
|
Hello all, can anyone tell me what function will manipulate file attributes ? - I want to write a specialised backup program and need to be able to reset the archive attribute on a set of files. Thanks for any help !
Doug
|
|
|
|
|
Here is one solution
Reading file attributes:
GetFileAttributes()
GetFileAttributesEx()
Modifying file attributes:
SetFileAttributes()
Kuphryn
|
|
|
|
|
Hi Kuphryn, Now why couldn't I find that in VC++ Help ??? I'm blind, I guess !! Many thanks for your help !
Doug
|
|
|
|
|
|
I have created a MFC single document application on VC++ 6.0 on a Win98 machine. I have done some testing on WinXP machines and it does not work correctly. I have included in stdafx.h the line
#define _WIN32_WINNT 0x0502
but it still does not work. Any help is greatly appreciated.
Brad Jennings
|
|
|
|
|
Oh, I forgot to mention that the program is multi-threaded. It doesn't seem to have any problems until a new thread is created.
Brad Jennings
|
|
|
|
|
Nevermind, it wasn't my program. My F8 key was sticking. Thanks.
Brad Jennings
|
|
|
|
|
Hi !
I'm writing a heap mangement functions namely Alloc and Free. An array of 4096 character is simulated as the heap. The main progam which has been written call Alloc 60% of the time and Free 40% of the time. The heap management is implemented by the linked-list. The algorithm to choose the page is first fit. The Alloc is passed in the number of bytes to be allocated. The Free function takes in the pointer at the begining of the chunk to be allocated.
Here is what i've attempt at it. I define a linked-list structure with *next is the pointer to the next node, size is the size in byte of how big the chunk is.
<br />
<br />
#include <windows.h><br />
#include "ssHeap.h"<br />
<br />
<br />
typedef struct _HEAP_STRUCT<br />
{<br />
DWORD size;<br />
struct _HEAP_STRUCT *next;<br />
}HEAP_STRUCT;<br />
<br />
<br />
HEAP_STRUCT *front;<br />
<br />
HEAP_STRUCT *temp, *prevNode;<br />
HEAP_STRUCT *node;<br />
<br />
<br />
<br />
char HeapSpace[4096];<br />
LPVOID beginOfTheHeap;<br />
<br />
void ssInit(void)<br />
{<br />
<br />
front = new HEAP_STRUCT;<br />
beginOfTheHeap = malloc(sizeof(HeapSpace));<br />
front = (HEAP_STRUCT*)beginOfTheHeap;<br />
<br />
front->next = NULL;<br />
front->size = 0;<br />
<br />
node = new HEAP_STRUCT;<br />
node->next = NULL;<br />
node->size = 0;<br />
<br />
<br />
};<br />
<br />
<br />
LPVOID ssAlloc(LONG nBytes)<br />
{<br />
HEAP_STRUCT *alloc = new HEAP_STRUCT;<br />
int allocated = false;<br />
<br />
while(nBytes % 8 != 0)
nBytes++;
<br />
<br />
if(front->next == NULL)
{<br />
<br />
node = new HEAP_STRUCT;
node->next = NULL;
node = front + nBytes;
<br />
<br />
front->size = nBytes;
front->next = node; <br />
return node;<br />
}<br />
<br />
<br />
<br />
while(front->next != NULL)<br />
{<br />
long freeSpace = ((int)front->next - (int)(front + front->size))/sizeof(char);
<br />
if( freeSpace> nBytes)
{<br />
<br />
while(freeSpace != nBytes)
{<br />
freeSpace = freeSpace / 2;
}<br />
<br />
node = new HEAP_STRUCT;
node = front + front->size;
node->size = nBytes;<br />
node->next = front->next ;
front->next = node;
alloc = node;
<br />
allocated = true;
}<br />
else <br />
{<br />
front = front->next;<br />
}<br />
}<br />
<br />
<br />
if(allocated)
return LPVOID(alloc);<br />
else
return NULL;<br />
<br />
};<br />
<br />
<br />
void ssFree(LPVOID p)<br />
{<br />
<br />
if(front == (HEAP_STRUCT*)p)
{<br />
front->size = 0;<br />
}<br />
else<br />
{<br />
prevNode = new HEAP_STRUCT;<br />
temp = new HEAP_STRUCT;<br />
<br />
<br />
while(front->next->next != NULL)<br />
{<br />
prevNode = front;
<br />
if(front->next ==(HEAP_STRUCT*)p)<br />
{ <br />
temp = front->next->next;<br />
prevNode = temp;<br />
delete front->next;<br />
}<br />
<br />
front->next = front->next->next ;
}<br />
<br />
}<br />
};<br />
<br />
Any constructive comment is highly appreciated!!
Regard,
|
|
|
|
|
Probably lots of time is lost in finding a chunk of the wanted size. This used to be a known problem in C run time libraries, that's why many people wrote their own memory management module.
A good idea is to prepare 'pools' of predefined sizes (e.g. multiples of 8) and manage lists of vectors in each of the pools.
If your application then requests e.g. 15 bytes, you round it up to the next multiple of 8 (16 in this case) and then go to the pool of 16 bytes. If it's empty, you allocate space for e.g. 10 chunks of 16 bytes. The next time you need 16 bytes (>9, <=16), it will be much faster.
Of course you need to foresee additional list-pointers in your vector of 10 chunks of 16 bytes to store information about which chunk is already handed out to the application, which one is free, what the size is, ...
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
Hi! The following values, which are greater
front = 0x003223d8
front->next = 0x00323118
Thanks, i have not clue which one is greater nor what they means! The only thing i know is that they are virtual address of a process. !!
Another thing is if i take
front->next - front
what does it give me???
Thanks
|
|
|
|
|
the numbers are too complicated: if u ask 1 and 3, which is "greater", i know the answer.
front->next - front is really meaningless except u do special research.
don't stick on those kind problems when u start to learn c++, or u will get lost.
includeh10
|
|
|
|
|
|
|
Those are hexadecimal numbers, base 16. That is what the 0x prefix means. Each digit can be 0-9 or a-f, where a-f represent decimal 10-15. So 3223d8 is less than 323118.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
How to disable the taskbar name of any process
|
|
|
|
|
suresh_sathya wrote:
How to disable the taskbar name of any process
Make the following changes in your CWinApp derived class's InitInstance() :-
m_pMainWnd->ShowWindow(SW_HIDE);
m_pMainWnd->ModifyStyleEx(WS_EX_APPWINDOW,WS_EX_TOOLWINDOW);
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
The two lines in bold are the newly added lines.
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
hello:
my question is: we know the modal dialog dont deal with WM_PAINT message
but when i have a button on a modal dialog to deal with a large data,how can
i refesh the dialog?i have used following code:
MSG msg;
if (!::PeekMessage(&msg.NULl,0,PM_REMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
in the for loop;but it is useless;who can tell me why?
-----------------------------
Mr.Whelk
-----------------------------
Zhuhai City ,Guangdong ,China
|
|
|
|
|
So you think a modal dialog box doesn't process WM_PAINT messages ? You think wrong.
How low can you go ? (MS retrofuck)
|
|
|
|