|
i need to insert item in a selected position
eg: if i have tree having one root and five child i need to add new item in the 3rd position but now i can only add it as a first or last item in my child (1st or 6th).
|
|
|
|
|
Get the HTREEITEM handle of the second item, and use it as the hInsertAfter parameter.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Hi,
I'm trying to disable a submenu in win32. It's working ok, but is there an alternative to this:
HMENU showMenu = GetSubMenu(currentMenu,2);
EnableMenuItem(showMenu,4,MF_BYPOSITION | MF_GRAYED);
I don't like MF_BYPOSITION, because the code will break if we add new menu items to 'showMenu' later on. Why do sub-menus not have ID's, so that I could just call EnableMenuItem() directly...?
Thanks!
/lacla
|
|
|
|
|
Why not use MF_BYCOMMAND against the id of the menuitem you want disabled?
|
|
|
|
|
As I indicated, submenus don't have id's as far as I can see. Otherwise I would have used the ID... It is a submenu (flyout) in the menu bar that I want to disable.
/lacla
|
|
|
|
|
I think the idiomatic way to do what you want is to grey out all the items on the sub-menu rather than to disable the sub-menu itself, basically because there's less cognitive dissonance for the user.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Stuart Dootson wrote: less cognitive dissonance for the user.
That sounds like something a real MVP would say
|
|
|
|
|
you can set the submenu normal then add showmenu ,at last you set the showmenu MF_GRAYED,do this the code should not break
|
|
|
|
|
Hi All,
I am working on a project which deals with writing byte stream (input)into AVI,ASF,MP4 formats.
we finished ASF and MP4 formats.now working on AVI.
First af all can we do this?
I have searched so many Codeproject topics.They are dealing with Writing bitmaps into AVI format.I tried that.Working fine.
but,im in the need of writting into AVI format from the Byte stream Format.
Im searching for this.I have not get any idea yet.
Could u help me?
Thanks in advance.
|
|
|
|
|
but,im in the need of writting into AVI format from the Byte stream Format.
Can you explain exactly what you mean with "AVI from bytestrem".
Do you mean to open lets say a mpeg file as filestream and then save the "stream" as avi file?
Or do you mean to extract the audio stream from a mpeg to a avi stream and then extract image by image from mpeg (sorry but I don't know how the mpeg format stores the data) and save it in the avi stream?
Greetings
Covean
|
|
|
|
|
Hi,
Thanks for ur response.
Obsolutely Yes.Ur first Statement is my question.
can we write into AVI format from mpeg byte stream ?
|
|
|
|
|
Edit:
After reading your first question again, I saw that you already made this with the windows API.
So I have to say sorry I don't think I can help you any further.
Maybe the compressor COM-interface ICCompress gives you a new starting point/idea how to start (but there you also have to deliver image by image).
Greetings
Covean
modified on Wednesday, January 13, 2010 5:00 AM
|
|
|
|
|
Here I found some interesting link for you maybe it helps.
AVI File Format
Greetings
Covean
|
|
|
|
|
Hey,
I'm wondering how the OS converts the data in exes (specifically calls) into, for example E8 6CAA0100. I'm not sure if this is the phyiscal address that I want, but I think it is.
I'm wondering because I want to find all references to a function in another process, then dump the data that gets passed to it. I think this would be more efficient than using virtual addresses (ie running the process) because the data I'd be searching for would change depending of the address that is calling the function. Any help would be appreciated, thanks.
|
|
|
|
|
urbanyoung wrote: I'm wondering because I want to find all references to a function in another process, then dump the data that gets passed to it. I think this would be more efficient than using virtual addresses (ie running the process) because the data I'd be searching for would change depending of the address that is calling the function.
I'm a bit confused here, you say you want the address of something in a process but then imply the process will not be running. How do you think you can get the address of something that does not exist?
|
|
|
|
|
After reading your "question" I would assume that you want to know the physical address of a function in memory to "hook"/"inject" it to get all the data passed to this function. And you think its easier
to find the "real" address of this function so you do not need to look in every process where the "function entry" may be on a different "virtual address" location? Did I unterstand you right?
If so then I would say the idea is good, but if you take a deeper look in how an os encapsules the "real"-addresses from the user-code part, you will find out, that it will be possible but its hard work.
Just one thing to think of: You know that the os can put some memory sections in the swap file if it needs free memory storage and so its possible that also your "function"-pointer gets swapped.
Greetings
Covean
|
|
|
|
|
urbanyoung wrote: I'm wondering how the OS converts the data in exes (specifically calls) into, for example E8 6CAA0100. I'm not sure if this is the phyiscal address that I want, but I think it is.
It is actually done by CPU at the hardware level. See the AMD64 programming manual for details[^]
|
|
|
|
|
Hi,
as I understand it, and unless you are developing a device driver, you should not worry about physical addresses: everything is virtual within its own process; if you want to access some data (or code) in another process, use its virtual addressthere. I think I have an example in my LP#TrayIconBuster article[^] (which uses managed code, C#, but that doesn't change the theory).
|
|
|
|
|
You should look up the PE File Format. In short, the compiler/linker fixes the 'Call' addresses in exe's on the basis that the exe will be loaded at starting address 0x00400000. (All recent MS OpSystes load all processes there.) In the case of DLL Code (which can be loaded anywhere) the compiler/linker includes a relocation table, containing details of the memory locations which must be changed depending on the load address.
The beauty of Virtual memory is that each process 'thinks' that it has the entire 4GB memory range available, all for itself, even if you don't have 4GB of RAM installed.
BTW IMHO your question has absolutely nothing to do with physical memory. Physical addresses are both invisible and unimportant to processes. As for referring to a function in another process: basically you can't do that. Windows ensures that processes are invisible from eachother. That is a good thing. It means for instance that your program operates exactly the same whether you also run a copy of MS Office on the same computer or not! MS Office is completely unaware of your program, and viceversa.
Bram van Kampen
|
|
|
|
|
Actually, you may run your process as a debugger, and then you can have access to the other process's data and code (I am talking about machine language; binaries here).
|
|
|
|
|
Yes ofcourse, and there are other methods to facilitate interprocess communication (shared Memory in DLL's for instance).However, from the original question it occurred to me that the OP had a picture in mind, of memory, similar to the old 16 bit windows, (where All Processes addressed physical memory), and also had little understanding of Logical vs Physical memory.
He seemed to think that somehow the program loader translates from logical to physical memory, (which is ofcourse NOT the case), and seems to miss the entire concept of logical memory.
So, I did not mention the exceptions, and workarounds, but concentrated on the basic tennet, that each process has it's own private 4GB memory space, where (in principle at least) other processes cannot tresspass.
Thanks for your comment though,
Regards
Bram van Kampen
|
|
|
|
|
GetlastError() returning 87 when i use EndPage() in my printing application...please let me know the reason
kir_MFC
|
|
|
|
|
kir_MFC wrote: GetlastError() returning 87 when i use EndPage() in my printing application...
Strange, 87 is: "The parameter is incorrect.".
Did EndPage() fail? Could you post the relevant code?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
if (!screen_print)
{
//debug(_S("prt line: abort %d '%s'"), fAbort, buf);
/* output current line */
/*
CODE STARTS --> RFC 40589
DATE --> 26/03/2007
*/
//Check if this is House Account Report
if (bIsHouseAccountReport)
{
HFONT m_hNewFont;
LOGFONT m_lfOldFont, m_lfNewFont;
//Get the current font and this will be our old font
::GetObject(hPrinterFont,sizeof(LOGFONT),&m_lfOldFont);
//Copy the oldfont to new font
m_lfNewFont = m_lfOldFont;
//Change the face name of the new font to "Courier New" as this is the only
//font in which all columns are aligned properly
_tcscpy(m_lfNewFont.lfFaceName, "Courier New");
m_hNewFont = CreateFontIndirect(&m_lfNewFont);
::SelectObject(pdc,m_hNewFont);
//Textout with the newly selected font
TextOut(pdc, 0, (CurrentLine - 1) * LineSpace, buf, strlen(buf));
//Select the old font for other reports to print as it is
::SelectObject(pdc,hPrinterFont);
}
/*
CODE ENDS --> RFC 40589
*/
else
TextOut(pdc, 0, (CurrentLine - 1) * LineSpace, buf, strlen(buf));
CurrentLine += 1;
/* check for page breaks */
if (CurrentLine > LinesPerPage)
{
CurrentLine = 1;
CurrentPage += 1;
if ( hPrinterFont != 0 )
{
SelectObject( pdc, hOldFont );
}
prt_set();
IOStatus = EndPage(pdc);
DWORD dw = GetLastError();
if(dw)
MessageBox (NULL, TEXT ("Hello, Windows 98!"), TEXT ("HelloMsg"), 0) ;
if ( hPrinterFont != 0 )
{
SelectObject( pdc, hPrinterFont );
}
if (IOStatus < 0 || fAbort)
{
fAbort = TRUE;
return -1;//RFC 78192
}
StartPage(pdc);
return -1;
}
}
/* screen print */
else
{
FIOW::fprintf(prtfile, _S("%s\n"), buf);
CurrentLine += 1;
if (CurrentLine > LinesPerPage)
{
CurrentLine = 1;
CurrentPage += 1;
return -1;
}
}
kir_MFC
|
|
|
|
|
Please use the "code block " button to post code snippets.
Is it the printer device context pdc valid (I can't spot its initialization in code provided)?
Have you called StartDoc and StartPage , before actually calling EndPage (again I can't see the above calls).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|