|
In addition to what Mark said, if you make use of the clip box (CDC::GetClipBox) you can limit your drawing to just the areas of the window that need repainting instead of repainting the entire window every time.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hello,
anybody knows how to activate all views in MDI without going thru
CDocManager dialog?
I have tryed GetFirst... GetNext.. but it only works on views which are already active.
Ideally I like to have all templates views tilled on opening the application.
Thanks for reading.
|
|
|
|
|
POSITION pos = MyApp.GetFirstDocTemplatePosition();
while (NULL != pos)
{
CDocTemplate *pTemplate = MyApp.GetNextDocTemplate(pos);
pTemplate->OpenDocumentFile(NULL);
}
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
|
i have a 1000*1024 8bit UINT8 array
how can i save it as a bmp or tiff file??
the size of the picture is fixed, as simple as possible, just an array with fixed size and bitsize.
and need to be saved as fast as possible
thanks alot!
|
|
|
|
|
For BMP...
Initialize and write
1) a BITMAPFILEHEADER structure
2) a BITMAPINFO or BITMAPCOREINFO structure
3) the image bytes from your array
For TIFF (and BMP and others) you could use GDI+
1) Create a GDI+ Image object from your image data bytes
2) Use Image::Save() to save in a variety of formats
Mark
|
|
|
|
|
Assuming the bytes are in the right order, use CreateFile() to create/open the file, and use WriteFile() to write to the file.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all my friendz,
i'm developing an application to check multiple mail accounts. I use Iwebbrowser2...and so IE to browse mails.
Now I'm considering a problem. Suppose a person who uses my tool has an instance of IE open...and suppose he has just controlled his mail(without logging out)...my tool starts its check but goes directly inside the account(does not find login page)...and so the tool does'nt find the page it expect to find and fails.
Even if i delete the cookie associated to that account before running the check, if another IE browser instance is open the information remains! (i think in index.dat).
So there is some way to go in any case at login page, without considering the informations in index.dat or cookies???...
please help (
|
|
|
|
|
I am opening a file in readwrite and shareexclusive mode, but later want to change this to different access and share modes, but can't figure out how to do it. I tried using SetStatus but it doesn't seem to work (I think I don't know how to set the m_attributes correctly)... I am currently closing the file and reopening it, which feels like a cludge to me! Any suggestions?
First time opening file:
CFile writeFile;
writeFile.Open(curFile, CFile::modeCreate | CFile::modeReadWrite | CFile::shareExclusive, &fileException)
Then I close and reopen:
writeFile.Close();
writeFile.Open(curFile, CFile::modeRead | CFile::shareDenyWrite, &fileException);
The SetStatus code that is NOT working is:
CFileStatus status;
writeFile.GetStatus( status );
status.m_attribute = status.m_attribute | writeFile.readOnly;
writeFile.SetStatus( curFile, status );
Thanks in advance!
|
|
|
|
|
The open flags are not the same as the file status flags.
Try ReOpenFile() on the m_hFile member of the CFile instead of closing and reopening.
Never mind ReOpenFile() is Server 2003 or better
Mark
|
|
|
|
|
Hey thanks! Do I still need to close the file first?
|
|
|
|
|
>>Do I still need to close the file first?
Looks like it, unfortunately. Even ReOpenFile won't let you change the sharing mode without
closing the handle first. At least that's what I gathered from the SDK.
I'd say closing and reopening is the only way to go ... I may be wrong
Mark
|
|
|
|
|
Need to know if I can directly access elements in an STL array based on the Iterator ..
As for eg
List contains { 1,2,3,4,5,6,7,8 }
if List::Iterator iter = List.begin()
Now to access nth element can the routine be like
int GetElementAt( int index)
{
// range check
iter = List.begin();
iter+=index;
return *iter ;
}
Engineering is the effort !
|
|
|
|
|
act_x wrote: Engineering is the effort !
what happened when you tried it?
cje
|
|
|
|
|
A std::list isn't an "array" and list iterators don't support random access. Vector and deque iterators support the += operator.
|
|
|
|
|
act_x wrote: iter+=index;
try
std::advance(iter, index);
Might work
|
|
|
|
|
will
for(int i=0;i<index;i++,iter++) ;
this="" should="" work="" as="" the="" ++="" operator="" is="" supported="" for="" iterator="" ?=""
=""
<div="" class="ForumSig">Engineering is the effort !
|
|
|
|
|
yes the ++ operator should be supported for the iterator
I sugest you look at the doco
|
|
|
|
|
I created a SDI application which is containing tree control displaying FOlders and files of a System.Now i want ot add functionality drag and drop from GUI to Explorer and Explorer to GUI.When i dragged from explorer to tree, the dragged files and folders to be added where i droped(for ex: if i dropped on USB drive the respected files and folders added to USB drive)
Any ideas?
|
|
|
|
|
See DragAcceptFiles(), WM_DROPFILES, DragQueryFile(), DragFinish(), etc.
Mark
|
|
|
|
|
My tree controlis accepting files after dropping the files how can i handle it?
Meand how can i copied the dropped files to respected folder or drive
|
|
|
|
|
Im not sure do you need to DragQueryFile ?
|
|
|
|
|
Hi fellows. I created an app that have 2 menus. The code for these menus are below:
<br />
hMenu1 = CreateMenu();<br />
hMenu2 = CreateMenu();<br />
hSubMenu1 = CreateMenu();<br />
hSubMenu2 = CreateMenu();<br />
unsigned int uiParams[5];<br />
unsigned int uiNums[5];<br />
unsigned int uiSize = 5;<br />
char cNames[][256] = {"&Menu", "&Estudo Anatômico", "M&odelo com Transparência", "", "&Sair"};<br />
uiParams[0] = MF_STRING|MF_POPUP;<br />
uiParams[1] = uiParams[2] = uiParams[4] = MF_STRING;<br />
uiParams[3] = MF_SEPARATOR;<br />
uiNums[0] = 0; uiNums[1] = 1; uiNums[2] = 2; uiNums[3] = 3; uiNums[4] = 4;<br />
MenuCreator(hMenu1, hSubMenu1, uiParams, uiNums, cNames, uiSize);<br />
SetMenu(hwnd, hMenu1);<br />
DrawMenuBar(hwnd);<br />
char cNames2[][256] = {"&Controles", "&Habilitar/Desabilitar Controles"};<br />
uiParams[0] = MF_STRING|MF_POPUP; uiParams[1] = MF_STRING;<br />
uiNums[0] = 5; uiNums[1] = 6;<br />
uiSize = 2;<br />
MenuCreator(hMenu2, hSubMenu2, uiParams, uiNums, cNames2, uiSize);<br />
SetMenu(hwnd, hMenu2);<br />
I have a function that create menus dynamically. Here it is:
<br />
void MenuCreator(HMENU hParentMenu, HMENU hChildMenu, unsigned int uiBehaviors[], unsigned int uiIDItems[], char cNameItems[][256], unsigned int uiSize)<br />
{<br />
if(hParentMenu == NULL || (hParentMenu == NULL && hChildMenu != NULL))<br />
{<br />
MessageBox(NULL, "Menu pai não pode ser nulo", "Erro", MB_OK|MB_ICONERROR);<br />
return;<br />
}<br />
if(hParentMenu != NULL && hChildMenu != NULL)<br />
{<br />
for(int i = 1 ; i < uiSize ; i++)AppendMenu(hChildMenu, uiBehaviors[i], uiIDItems[i], cNameItems[i]);<br />
AppendMenu(hParentMenu, uiBehaviors[0], (unsigned int)hChildMenu, cNameItems[0]);<br />
return;<br />
}<br />
if(hParentMenu != NULL && hChildMenu == NULL)<br />
{<br />
for(int i = 0 ; i < uiSize ; i++)<br />
{<br />
AppendMenu(hChildMenu, uiBehaviors[i], uiIDItems[i], cNameItems[i]);<br />
}<br />
return;<br />
}<br />
}<br />
when I insert the first menu, works fine. When I insert the other, the first menu isn't there, just the second. What I want to do is to have 2 or more menus at the same time, like File|Edit|View.
What's going on? Thanks
|
|
|
|
|
Problem solved, I was create 2 main menus. So, when I insert the other main menu it was overlapping the other. I deleted the other main menu and add the items in only 1 main menu
|
|
|
|
|
The application must call the "DrawMenuBar" function whenever a menu changes, whether or not the menu is in a displayed window.
|
|
|
|