|
Hi,
I need those 2 functions : ImageList_Read & ImageList_Write functions... It seems they already exist in comcntl32 . More of this I’ve found this code :
In Winctrl2.cpp
#ifndef _AFX_NO_OLE_SUPPORT
extern "C"
{
HIMAGELIST WINAPI ImageList_Read(LPSTREAM pstm);
BOOL WINAPI ImageList_Write(HIMAGELIST himl, LPSTREAM pstm);
}
#endif
…
BOOL CImageList::Write(CArchive* pArchive)
BOOL CImageList::Read(CArchive* pArchive)
This is what I need but I’m unable to use it because it is in a #ifndef _AFX_NO_OLE_SUPPORT compilation condition. So, I don’t know how I can access it.
What is the #ifndef _AFX_NO_OLE_SUPPORT for? Where does it come from?
I really need ImageList_Read & ImageList_Write or BOOL CImageList::Write(CArchive* pArchive), BOOL CImageList::Read(CArchive* pArchive)
Can anybody help me please? Is there a sample project somewhere that uses the ImageList_Read & ImageList_Write functions?
Thank you very much in advance.
Best regards
Guy LECOMTE
|
|
|
|
|
Hi,
I have troubles with CRecentFileList.
I want to manage the Recent Files manually if I do an "Open" or a "Save As" in my SDI-Document.
My RecentFileList has the ID "Hi,
I have troubles with CRecentFileList.
I want to manage the Recent Files manually if I do an "Open" or a "Save As" in my SDI-Document.
My RecentFileList has the ID "ID_FILE_MRU_FILE1" in my menu "ID_MAINFRAME".
This is my code, which I call at an "Open" or a "Save As":
void CMainFrame::setMRU(CString File)
{
CRecentFileList* m_pMRU;
m_pMRU = new CRecentFileList( 1, _T("Software\\tsSoft\\nm\\MRU"), _T("File#%d"), 4 );
m_pMRU->ReadList();
char* a = (char*) malloc(File.GetLength()+1);
sprintf(a,"%s",File.GetBuffer(File.GetLength()));
//MessageBox((*m_pMRU)[0]+"Pferd",(*m_pMRU)[0],MB_OK);
//MessageBox((*m_pMRU)[1]+"Pferd",(*m_pMRU)[1],MB_OK);
if( File.GetLength()>0 ) m_pMRU->Add(a);
m_pMRU->WriteList();
// Eintrag suchen und überschreiben
CCmdUI* cmdUI = new CCmdUI();
cmdUI->m_nID = ID_FILE_MRU_FILE1;
cmdUI->m_pMenu = AfxGetMainWnd()->GetMenu()->GetSubMenu( 0);
for( cmdUI->m_nIndex=0; cmdUI->m_nIndex < cmdUI->m_pMenu->GetMenuItemCount(); cmdUI->m_nIndex++) {
if( cmdUI->m_pMenu->GetMenuItemID(cmdUI->m_nIndex)==cmdUI->m_nID) {
m_pMRU->UpdateMenu(cmdUI);
break;
}
}
}
What is the problem with it?
I got 2.
First, I can't see my Files in the registry at "Software\\tsSoft\\nm\\MRU" and I don't know why and second I got an Assertion-Error at "m_pMRU->UpdateMenu(cmdUI);"
It will be very nice, if someone can help me to solve my problem!
Greetings,
Tobias
PS: Excuse my bad english!" in my menu "ID_MAINFRAME".
This is my code, which I call at an "Open" or a "Save As":
void CMainFrame::setMRU(CString File)
{
CRecentFileList* m_pMRU;
m_pMRU = new CRecentFileList( 1, _T("Software\\tsSoft\\nm\\MRU"), _T("File#%d"), 4 );
m_pMRU->ReadList();
char* a = (char*) malloc(File.GetLength()+1);
sprintf(a,"%s",File.GetBuffer(File.GetLength()));
//MessageBox((*m_pMRU)[0]+"Pferd",(*m_pMRU)[0],MB_OK);
//MessageBox((*m_pMRU)[1]+"Pferd",(*m_pMRU)[1],MB_OK);
if( File.GetLength()>0 ) m_pMRU->Add(a);
m_pMRU->WriteList();
// Eintrag suchen und überschreiben
CCmdUI* cmdUI = new CCmdUI();
cmdUI->m_nID = ID_FILE_MRU_FILE1;
cmdUI->m_pMenu = AfxGetMainWnd()->GetMenu()->GetSubMenu( 0);
for( cmdUI->m_nIndex=0; cmdUI->m_nIndex < cmdUI->m_pMenu->GetMenuItemCount(); cmdUI->m_nIndex++) {
if( cmdUI->m_pMenu->GetMenuItemID(cmdUI->m_nIndex)==cmdUI->m_nID) {
m_pMRU->UpdateMenu(cmdUI);
break;
}
}
}
What is the problem with it?
I got 2.
First, I can't see my Files in the registry at "Software\\tsSoft\\nm\\MRU" and I don't know why and second I got an Assertion-Error at "m_pMRU->UpdateMenu(cmdUI);"
How can I make it working right? So that my Recent Files are shown at "ID_FILE_MRU_FILE1" ?
It will be very nice, if someone can help me to solve my problem!
Greetings,
Tobias
PS: Excuse my bad english!
|
|
|
|
|
Hi,
ich have troubles with
|
|
|
|
|
Hi i would like to know how to open a folder, from hitting a button on a dialog wizard/app.
What i want to achieve is this:
This wizard i want to create will create a file which is needed by a 3rd party program. What i want to do is once the button is pressed which creates the new folder, i want to press another button which will open up the folder where that new file was created. I dont ned to know how to create buttons etc. Its just how do i open a normal folder from clicking on a button?
Any ideas?
kind regards
Dave Long
|
|
|
|
|
What do you mean "open" a folder? If the program creates a file in a specific folder and that folder does not exist, then the program should loop through the full folder path and create each folder accordingly beginning at the parent folder, i.e. "C:\"
Kuphryn
|
|
|
|
|
The folder already exists and the file that gets created is placed in that existing folder. All i want is to be able to click a button on the wizard to display that folder without having to manually open it by double clicking icons until i get to the folder to display the file.
Dave Long
|
|
|
|
|
ShellExecute() with the command line being the folder path.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Hi,
Try the following code, it will open the specified folder in
explorer.
void UserDialog::OnButtonClicked()
{
ShellExecute(GetSafeHwnd (), "open", "C:\\dave\\folder",
NULL, NULL, SW_SHOWNORMAL);
}
regards
~Hari~
|
|
|
|
|
Hi Hari
Great thanks that worked a treat.
kind regards
Dave Long
Hi,
Try the following code, it will open the specified folder in
explorer.
void UserDialog::OnButtonclicked()
{
ShellExecute(GetSafeHwnd (), "open", "C:\\dave\\folder",
NULL, NULL, SW_SHOWNORMAL);
}
regards
~Hari~
|
|
|
|
|
I'm having trouble passing a pointer to and array. I've created a class that has and array of 10.
CString pArray[10];
...
..
return * pArray;
Is this right?
Then in my calling function I'm not sure how to handle this pointer. Any suggestions?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote:
return * pArray;
Is this right?
Unfortunately no. In the absense of any other code, I will suggest the following, though it may not work.
return &pArray[0];
Questions for you, since the array is contained within a class, istead of providing direct access to the member, why not provide Set/Get methods for the strings? Why not use the CStringArray class? Or even the STL equivalent?
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"Microsoft hasn't ever enforced its patents. Apparently they keep them for defensive reasons only. Or, they could be waiting 'til they have a critical mass of patents, enforce them all at once and win the game of Risk that they're playing with the world." Chris Sells Feb 18, 2003.
|
|
|
|
|
An array variable is basically just a pointer to a block of memory. In other words, it's already a pointer, so you can just return it:
return pArray;
Just make sure that your pArray variable is a member of your class, so that it hangs around longer than the scope of the function that returns it.
class A
{
private:
CString array[10];
...
public:
CString* GetArray()
{
return array;
}
};
void foo()
{
A a;
CString* array = a.GetArray();
CString strCopyOfFirstElement = array[0];
CString& strLastElement = array[9];
}
Regards,
Alvaro
If you want to get to the top, prepare to kiss a lot of bottom. -- despair.com
|
|
|
|
|
Alvaro
Thanks for the help. Your suggestion worked. I'm still a little confused on pointers and excatly how they work. I guess what you are saying is that since its already a pointer all I have to do is pass it and nothing special just view it as an array from my calling function.
One other question. Do I need to destroy that pointer after I pass it, to release that memory?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Alvaro
Thanks. Your suggestion worked. One other question do I need to delete that pointer? So that is doesn't take up memory?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
This topic is often the subject of much debate. Some folks claim that if your application is intended to run for days/weeks/etc (e.g., service), it needs to be as clean as possible so that a "slow" memory leak does not eventually turn into a big problem. If, on the other hand, your application is only used a few times, and only exists for a few minutes when it is used, a memory leak here and there is harmless as the OS will return to the memory manager any memory owned by your application once your application terminates.
My take on the subject is it's always nice to clean up dynamically allocated memory, regardless of whether the OS cleans up behind you or not. ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Tom Wright wrote:
CString pArray[10];
...
..
return * pArray;
Is this right?
if you did this in one of ur member function, then it is quite nonsense.
just keep the array as global/member variable or use the pointer (allocate the number as u like) and then retun the address...
regards,
CodeTheDreams();
|
|
|
|
|
I would like to import, display and print PDF or postscript documents (whichever would be easier) as a background for my forms. Is there a decent C++ library out there?
Regards,
BB
|
|
|
|
|
|
Hey Friends
Can someone suggest how to Get Pointer to Main Menu in case of MDI Application.
I am Using Code Like this
CMenu *pMenu;
CFrameWnd *pFrame;
pFrame = (CFrameWnd *)(::AfxGetApp()->m_pMainWnd);
pFrame = pFrame->GetActiveFrame();
pMenu = pFrame->GetMenu();
The above code dose'nt works when Caled from a PropertyPage(ie pMenu is NULL)
Pl Help.
|
|
|
|
|
Anonymous wrote:
pFrame = pFrame->GetActiveFrame();
Remove this line and it should work. In a MDI app this returns the active child frame, which doesn't own the menu.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Hi, I wrote a dll to retrieve data from a table of a web page. That works fine. But there are also tables protected by some Javescript code. The scriptcode get's the login/password and makes a "document.login_form.submit()". How could I emulate this behavior within my dll. To give GetHttpConnection() the login/password parameter doesn't work, because the page isn't direct protected. There shouldn't be any interaction. Thanx, Norbert
Norbert Behrens, Gruenheider Weg 36, 12589 Berlin, Germany
|
|
|
|
|
Hi
I've made a clistctrl + subclassed it to add more functions.
My list-view looks like this:
Employee Nr Name Age School
1 MyStupidName 15 SKL(BUTTON)
..
All fields are not editable + added some extended styles (gridlines, full row select).
If you click on the button, a dialog should appear with another listcontrol displaying all schools. After selecting a school + pressing ok, the name of the school should appear before the button.
The form is already made with all schools in the list, and when you press ok, it returns the name of the school. So that part is ok.
But how do i insert such a button into a listcontrol at the correct place of every line?
Hope someone knows how to get this done.
Just edited:
and i use VC5
Greetings
Jens
|
|
|
|
|
You may have to resort to owner-drawing the cell in question.
|
|
|
|
|
if you don't want to ownerdraw...
take a look here in CP about a recent article on how to create more than one button dinamically.
Moreover there's another article here or in codeguru (I don't remember very well) about editing a listctrl and the author creates a combobox inside a cell... (you could create dynamically some buttons inside the desired cells...)
Hope this helps...
NOTE:
if you ownerdraw, or if you do this other solution, derive a CListCtrl and place the code there, you'll be able to reuse tha class wherever you want to.
|
|
|
|
|
I have a CSpinButton control buddied to a CEdit, and that is fine for changing a numeric value.
The problem is that I want an even which occurs and will generate an action.
I have tried UDN_DELTAPOS, but this shows the value of the CSpinButtonCtrl before it is changed by the up/down event.
Also, when I try accessing the value of the text in the CEdit box, I get an exception.
Any ideas ?
Thanks.
Elaine
The tigress is here ![Big Grin | :-D](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_biggrin.gif)
|
|
|
|