|
Did you not ask this[^] question yesterday? Or is that you've developed a new application today? Well, it applies for all new applications that you develop.
|
|
|
|
|
I thought the question looked familiar...
|
|
|
|
|
thanks Mark:
i have these code in OnInitDialog
CTreeCtrl * tree = new CTreeCtrl();
CRect rect = new CRect(10, 10, 200, 200);
bool suc = tree->Create(WS_THICKFRAME, rect, this, IDC_TREE);
because WS_THICKFRAME, i can resize the tree control in run time
how can i override the OnSize method of this tree control?
also, how can i prevent the user from dragging the top and left border of the tree control to resize it?
Thanks!
|
|
|
|
|
nathan7 wrote: i have these code in OnInitDialog
CTreeCtrl * tree = new CTreeCtrl();
Why is this not a member of your dialog class?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
nathan7 wrote: Mark Salsbery pls come in
Hola.
nathan7 wrote: bool suc = tree->Create(WS_THICKFRAME, rect, this, IDC_TREE);
You may want (or need) the WS_VISIBLE, WS_CHILD, and WS_BORDER flags as well, plus any treeview-
specific styles.
nathan7 wrote: how can i override the OnSize method of this tree control?
Derive a class from CTreeCtrl and add a WM_SIZE handler there.
nathan7 wrote: also, how can i prevent the user from dragging the top and left border of the tree control to resize it?
I believe you can use the WM_SIZING message. This would be done in the derived class as well.
Also, see David Crow's reply - you'll probably want to deal with the scope of your "tree"
variable!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
Hi.
This code based on
Building Browser Helper Objects with Visual Studio 2005
Tony Schreiner, John Sudds
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ietechcol/cols/dnexpie/expie_hello_bho.asp
but i trying to manipulating the dom , with other javascript code. how can i do it,
this is the code ;
Code:
void CUygulama::QPencereGoster(IHTMLDocument2* pDocument)
{
HWND hwnd;
HRESULT hr = m_spWebBrowser->get_HWND((LONG_PTR*)&hwnd);
if (SUCCEEDED(hr))
{
// Javascript goes here
}
}
And this is the javascript
Code:
function popupPage() {
var page = "http://www.webservisidomaini.com/panel.php";
windowprops = "location=no,scrollbars=no,menubars=no,toolbars =no ,resizable=no,width=600 height=300";
window.open(page, "Popup", windowprops);}
how can i implement this js to c++ application. i think this need dom scripting. how can i do this ?
in this sample,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ietechcol/cols/dnexpie/expie_hello_bho.asp
please look for Manipulating the DOM section.
Example BHO code removing images from active web page, now i want to implement other js code, for like this example . How can i do this. any suggestions, resources i 'm looking for.
Thanks
|
|
|
|
|
Hi everyone. I'm new to Visual C++ (experienced with C++) and I'm not sure if my question is a Visual C++ problem. I want to develop a program very similar to a find feature in a web browser, BUT with very specific search features. I'm wondering if any of you guys know some codes that would allow a C++ application to look through a set of data in a web browser and return something (if there's a match). Or if this would be easier to make if it was an IE plug in. Hope to hear from someone soon!
|
|
|
|
|
|
I am trying to read values from from a text file using sscanf. The file contains numberic values but I want to read them in as strings, each line at a time. Values are listed as shown:
example text file:
1.000 2.000
3.000 4.000
5.000 6.000
...
Here is the code.
CStdioFile LFileData;<br />
...<br />
LFileData.ReadString(LCStrReadStr);<br />
MessageBox(LCStrReadStr);<br />
sscanf(LCStrReadStr, "%s %s", LCStrTemp1, LCStrTemp2);
The problem is that both LCStrTemp1 and LCStrTemp2 is getting the value of the 2nd column only. The first column is lost. I outputted LCStrReadStr using MessageBox to make sure it was correct. It is. So that problem is in sscanf. Why am I not getting the right values?
Thanks in advance.
|
|
|
|
|
What are LCStrTemp1 and LCStrTemp2?
They don't point to the same place do they?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
They are both CString declared like this. So they shouldn't be pointing to the same thing.
CString LCStrTemp1;<br />
CString LCStrTemp2;
|
|
|
|
|
You'll need to pass char* arguments to sscanf()...
char TestString[] = "1.000 2.000";
char StrTemp1[80];
char StrTemp2[80];
sscanf(TestString, "%79s %79s", StrTemp1, StrTemp2);
CString LCStrTemp1 = StrTemp1;
CString LCStrTemp2 = StrTemp2;
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
oh that worked! Thanks.
So I guess CString doesn't replace all string requirements...
|
|
|
|
|
acerunner316 wrote: So I guess CString doesn't replace all string requirements...
Not with old-school ANSI C functions like sscanf
The problem is with matching the argument(s) to the format specifier(s).
The %s format specifier means it'll look for a char*, and this char* must point to a buffer
as large as you specify or large enough to hold all expected scanned characters (or it will
crash).
Although CString lets you access its internal buffer, you'd have to be sure that buffer
is allocated and is big enough.
*edit* Oh yeah, there's CString::Tokenize() :)
Have fun!
Mark
-- modified at 20:50 Thursday 3rd May, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
My name is Jatinder and I work for Microsoft on the TechEd event. I generally read IT blogs to keep up with what is going on in the industry and decided to jump on in with a little plug for TechEd 2007 (June 4 – 8). This year we’ve dedicated 50% of the event content to developer specific tools with deep technical training that covers Visual Studio® 2005, Windows Vista™ development and the .NET Framework. You can also get in-depth information on building software using Visual C++®, Visual Basic® and Visual C#®. The incredible amount of information you can learn at TechEd is awesome but it is also an incredible place to network and let loose a little. The event is in Orlando, FL this year so the attendee party is at Universal Studios Islands of Adventure and the place is reserved for TechEd attendees only! Trust me, these parties are a blast. If you decide to go you should register now before it sells out like it did last year…we are also offering a bit of an incentive, all registrations before May 11th are entered to win either 1 of 5 Xbox 360 Elites (killer graphics) or 1 of 5 Amex gift cards (Disney ain’t cheap!) www.microsoft.com/teched
Jatinder Singh
|
|
|
|
|
MICROSOFT SPAM!!!
Hi Jatinder,
Maybe post this in The Lounge[^] instead of just the C++ board.
And include a link so us lazy people can just click: Microsoft Tech·Ed 2007[^]
Mark
p.s. And if anyone complains about the lounge post, I was never here.
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I need to add a Managed custom Web Control into a CSrollView window type in a large MFC application. Is that possible? The web articles I’ve seen seem to say that I need to upgrade to the CformView, but that will cause major problems for me since the existing MFC application windows are generic (used for several window types).
Thanks
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
|
I had seen that article, but it was a while ago. It did work for my application.
Thanks.
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
earlgraham wrote: It did work for my application
Cool! Thanks for the update. I've had that bookmarked but I haven't added any managed-side
UI stuff yet
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi all,
I'm kind of new to this level of MFC, but please bear with me. I am trying to implement an observer pattern, which has a piece of hardware as the subject and an MFC MDI interface as the observer. The problem I am having is when I try to notify the CMainFrame class from within the subject class code.
Here is an example of how I'm eventually notifying the MFC CMainFrame class:
Hardware_Callback() --> Subject::NotifyObservers() --> CMainFrame::Update(...)
However, within the CMainFrame::Update(...) call I access a statusBar object to update it with new information. But, I receive an assertion error because MFC is not in the correct state. How should I fix this problem? If you need more information I would be glad to produce more. Thanks!
-Will
|
|
|
|
|
A few questions...
Is the callback called on a different thread than the main frame wnd was created on?
What call(s) are you making to access the status bar?
What is the exact assertion message?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark!
Thanks for the reply! I actually was just about to post some more details, but I saw your questions (which are quite necessary
>Is the callback called on a different thread than the main frame wnd was created on?
I'm not exactly sure on this one. I haven't explicitly created a thread, but the callback function is utilizing functionality defined in a DLL. (So, I think the MFC run-time is no longer "awake" during this callback).
>What call(s) are you making to access the status bar?
int nIndicatorPane;<br />
nIndicatorPane = m_wndStatusBar.CommandToIndex(ID_STATUSBAR);<br />
if (nIndicatorPane != -1) <br />
{<br />
m_wndStatusBar.SetPaneText(nIndicatorPane,statusString,TRUE);<br />
}
It will first assert on the ::CommandToIndex(...), but if I comment that out it also asserts on ::SetPaneText(...)
>What is the exact assertion message?
It asserts on line 882 in wincore.cpp
ASSERT(pMap != NULL);
in function void CWnd::AssertValid() const
Also, some more info on the infrastructure of the program:
The class structure is basically and MDI template.
CMainFrame --contains--> CChildFrame --contains--> CChildView
CChildFrame also contains the Hardware_Controller class (which is the Subject in the Observer pattern).
The CChildView gets the actual data updates and the CMainFrame gets the error updates.
So, in the CChildFrame::OnCreate() I attach both of the observers to the subject like this
CMDIFrameWnd* pParentWnd = GetMDIFrame();<br />
ASSERT_KINDOF(CMainFrame, pParentWnd);<br />
CMainFrame* pMainFrame = (CMainFrame*)pParentWnd;<br />
<br />
m_HWController.Attach(pMainFrame);<br />
m_HWController.Attach(&m_wndView);
The updates to the ChildView work fine, and I suppose this is because both the Controller and the ChildView are members of CChildFrame. Is this correct? Thanks for your time!
-Will
|
|
|
|
|
Has the Windows object (HWND) been created for m_wndStatusBar?
In other words, have m_wndStatusBar.Create() (and probably m_wndStatusBar.SetIndicators()) been
called before you attempt to access the status bar?
Also, I'm not sure what type of object m_HWController is, but are these two calls ok?
m_HWController.Attach(pMainFrame);
m_HWController.Attach(&m_wndView);
I'm suspicious of an Attach call followed by another Attach call. What is m_HWController?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|