|
jdunlap wrote:
Nero also has an SDK. I think it's free.
Not quite. It needs Nero installed to run so it's not really "free"....
|
|
|
|
|
What is the fastest (in terms of performance) way to append text to a CEditview?
Thanks,
Davy
Blog for Software Testing, Bugs, Quality, Security and Stability - www.latedecember.com
News From Angus, Scotland - The Angus Blog My Personal Blog - Homepage.
|
|
|
|
|
Hi, can someone help me understand what is being done here ? This is a code snippet from a Visual Studio Add-in project, and i have a few questions about it (after the sample).
HRESULT CCommands::Function(IDispatch* theDocument)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CComQIPtr<ITextDocument,&IID_ITextDocument> pActiveDoc(theDocument);
if(pActiveDoc == NULL)
return S_OK;
CComPtr<IDispatch> pDispTextSel;
pActiveDoc->get_Selection(&pDispTextSel);
if (pDispTextSel == NULL)
return S_OK;
Maybe i am in the wrong forum, and this is all trivial ATL/COM stuff that i lack . Sorry if the questions are dumb .
1.What is pActiveDoc ? A pointer on the Idispatch *theDocument ?.
2.Where can I find the description of the get_Selection method ?
3.Where can I find the descrition of the method available for pActiveDoc ?
4. What is AFX_MANAGE_STATE(AfxGetStaticModuleState()); being done for ?
Actually, what I'm trying to do is get the filename of the active file in the Visual C++ editor...I was looking at another Add-In src to try and understand how this functions, but this is all not as easy as I thought
~RaGE();
|
|
|
|
|
1. pActiveDoc is a smart pointer to theDocument (wraps the pointer and takes care of object reference counting). since there is the Selection property, i guess that it is really a TextDocument object of DevStudio.
2.
Selection Property
Applies to: TextDocument object, TextWindow object
Gets the TextSelection object, which represents the selected text.
Syntax
object.Selection
Parameters
object - An expression that evaluates to a TextDocument object or a TextWindow object.
Remarks
The Selection property has the TextSelection type.
For the TextDocument object, the Selection property gets the object representing the text selected in a document's active view or in the topmost view if no views are active.
For the TextWindow object, the Selection property gets the object representing the text selected in the text window.
3. check the MSDN: Visual Tools and Languages -> Visual Studio 6.0 Documentation -> Visual C++ Documentation -> Using Visual C++ -> Visual C++ User's Guide -> Automating Tasks in Visual Studio. there's the description of VisualStudio object model.
4. AFX_MANAGE_STATE must be called at the beginning of every exported method in MFC dlls to correctly set the module state. find more details in MSDN
5. call Name or FullName property on pActiveDoc object
|
|
|
|
|
it is clearer now. Thank you very much.
~RaGE();
|
|
|
|
|
|
Thank you for the link.
~RaGE();
|
|
|
|
|
hello,
How can i modify style of child window,
i use
pChild->ModifyStyle(0,WS_THICKFRAME,SWP_NOMOVE | SWP_NOSIZE );
but the window haven't resizable border.
you know how to do this ?
thx in advance
|
|
|
|
|
does the window have WS_DLGFRAME style also? if it does, i think you will have to remove it. some window styles cannot be used together. also, for some styles you have to call SetWindowPos() after ModifyStyle(), to make them active (IIRC, ES_READONLY for edit controls ,etc)
|
|
|
|
|
thx Zed
my window doesn't have WS_DLGFRAME . I have a little problem with
SetWindowPos() :
pChild->SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED |<br />
SWP_NOMOVE | SWP_NOSIZE |<br />
SWP_NOZORDER);
after SetWindowPos my window has resizable borders, but i put the flags SWP_NOMOVE but my view move and it does not remain where it was.
So i would like to get border without call SetWindowPos it isn't posible ?
|
|
|
|
|
jeremysay wrote:
So i would like to get border without call SetWindowPosit isn't posible ?
i'm not sure
the problem is that SWP_FRAMECHANGED flags resulst in WM_NCCALCSIZE being sent to window, which forces the window to change its size. maybe you can add SWP_NOREDRAW flag which will defer repainting, and then call MoveWindow() to resize the window to its previous size. i'm not sure if this will work, but you can try
|
|
|
|
|
thx Zed for your help !
Zed wrote:
maybe you can add SWP_NOREDRAW flag which will defer repainting, and then call MoveWindow() to resize the window to its previous size. i'm not sure if this will work, but you can try
before call ModifyStyle ,i moved the view with ScrollWindow, there is a possibility to get "window scrolling" position (and not use GetScrollPos for scrollbar) ?
thx again Zed
|
|
|
|
|
GetScrollInfo(), but i'm not quiter sure what are you trying to achieve. can you post some more details?
|
|
|
|
|
in fact i scroll the view without use the scrollbar.
when i click in the view and move my mouse i do :
if (pMsg->message == WM_MOUSEMOVE) )
{
if (pMsg->wParam & VK_LBUTTON)
{
POINT Point = pMsg->pt;
long ScrollX = Point.x - m_Point.x;
long ScrollY = Point.y - m_Point.y;
ScrollWindow(-ScrollX,-ScrollY);
m_pPoint = Point
}
}
so i move my view and i don't know really its coordinates.
when i use :
pChild->SetWindowPos(NULL, 0, 0, 0, 0,SWP_FRAMECHANGED |
SWP_NOMOVE | SWP_NOSIZE |
SWP_NOZORDER);
my view loose its scrolling, so i want to know its coordinate before SetWindowPos .
Or get a way to put the sizable border without use SetWindowPos .
have you any idea ?
|
|
|
|
|
i'm not sure if i correctly understood the relationship between the view and pChild. is that the same window or are they parent-child?
if the view is scrolled only from your code, maybe you can accumulate ScrollX and ScrollY in every WM_MOUSEMOVE handler call and thus have the total ammount by which the view was scrolled, so you can use that (i'm just guessing here).
|
|
|
|
|
Zed wrote:
is that the same window or are they parent-child?
pChild is the parent child.
Zed wrote:
if the view is scrolled only from your code, maybe you can accumulate ScrollX and ScrollY in every WM_MOUSEMOVE handler call and thus have the total ammount by which the view was scrolled, so you can use that (i'm just guessing here).
OK thx, i'll go to do this, i hoped there was a "function" like GetScrollWindow"....but no.
thx Zed for you help!
|
|
|
|
|
Let's say I have a path to a file.
How to obtain an icon which is associated with ths file.
Any examples?
|
|
|
|
|
This little code snippet should help you on the way
SHFILEINFO shFileInfo;<br />
<br />
SHGetFileInfo(strFilename, FILE_ATTRIBUTE_NORMAL, &shFileInfo, sizeof(SHFILEINFO), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON);<br />
<br />
HICON hIcon = shFileInfo.hIcon;
|
|
|
|
|
Have a look at ExtractIconEx.
code snippet:
CString strIconFileName = strFile; //file name
if (!strIconFileName.IsEmpty ())
{
HICON hLargeIcon;
if (ExtractIconEx (strIconFileName, 0, &hLargeIcon, NULL, 1) == 1)
{
Debbie
|
|
|
|
|
Iam doing a MFC project for Asset Management .
The requirement is that when a user selects a file ,the application corresponding to that application should open and display /play the file ...
As an example ,if the file is c:\test.doc ,then MS word should be launched and should display the file ..
ANother exmaple is if the file is c:\media.rm ,then the real player should be opened and should play the file ..
How i do it in MFC ,or WIn 32 ???
|
|
|
|
|
check the ShellExecute() API
|
|
|
|
|
ShellExecute(...)
take a look at this function...
I think it's what you need...
Hope this helps.
|
|
|
|
|
Hi I hope you got a path to the file you want to be opened.
CString path;
Call
ShellExecute(NULL, "open",path, NULL, NULL, SW_SHOW);
Should work
|
|
|
|
|
Try to use the ShellExecute API command. See the MSDN libraray for details.
ShellExecute should do the job.
|
|
|
|
|
hi,
i've made a linked list that contains info that i want to read in another function. Wenn i make a new record and insert it into the linked list my programm crashes the next time it reads the list. it can read everything except for the new record.
i think it has something to do with the insertion of a wrong pointer. here's the code for inserting the new record:
<br />
Leverancier->LeverancierID = GetNewLeverancierID();<br />
NewLeverancier = new CLeverancierStruct;<br />
<br />
NewLeverancier = Leverancier;<br />
<br />
m_LeveranciersLijst.AddTail(NewLeverancier);<br />
the "Leverancier" variable contains the info that has to be inserted.
The next time i try to read the new record the programm just crashes on the point of retreving a CString it's value(for the struct).
[]D [] []D []
|
|
|
|