|
Thanks Ravi:
I will give it a try.
It seems that my thread cannot roll back to the front of the forum even I reply or update the message at latest time. How can I come to my thread to view other people's comment more easily?
Another forum, Javaranch.com, can roll back your thread to the front if you reply the message at latest time.
Thanks.
pad
|
|
|
|
|
Ravi:
It works now. Thanks a lot!
Do you know anyway that I can use string directly instead of a c_string? Or do you know how to convert a c_string to a string? Sorry about my dum questions.
padgyx
|
|
|
|
|
What type of control would be best suited for use as the editable icon display in an icon editor?
K
|
|
|
|
|
Anonymous wrote:
What type of control would be best suited for use as the editable icon display in an icon editor?
I dont think any windows control comes near the required functionality. So just create a window and handle all the required mouse messages and painting accordingly. In MFC you might derive a class from CWnd and write your own custom control.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
What I sometimes do for this kind of stuff is start with a CStatic. It has very limited functionality anyway, but you can draw it on a dialog in the dialog editor and get your layout sorted nicely.
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I have big array (about 1 000 - 100 000 items) . How can I detect what memory the app occupy ??
(Iam finding the best solution to store items in memory.)
|
|
|
|
|
Wizard_01 wrote:
I have big array (about 1 000 - 100 000 items) . How can I detect what memory the app occupy ??
That depends on the type of array. If it is an array of bytes, a 100,000 size array would be 100,000 bytes. If it is an array of objects or structs, then use sizeof to find the size of that object and multiply by 100,000.
Example :- for an array of type myStruct
tot_mem_reqd_for_array = array_size * sizeof myStruct
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Wizard_01 wrote:
I have big array (about 1 000 - 100 000 items) . How can I detect what memory the app occupy ??
For getting memory occupied by array you can use the sizeof operator.
int array[] = { 100, 200, 300 };
size_t sizearr = sizeof( array );
Atul
Sonork 100.13714 netdiva
|
|
|
|
|
Hi
I hope someone of you is able to solve my problem.
What I want to do is to write a plugin for the InternetExplorer (a so called BHO - Browser Helper Object) that will modify the HTML content before InternetExplorer displays the webpage.
I already wrote a plugin which will catch the DWebBrowserEvents2::DocumentComplete event. This is my code which works so far:
HRESULT __stdcall CCounter::DocumentComplete(IDispatch* pDisp, VARIANT * URL )
{
ATLTRACE(_T("CCounter::DocumentComplete\n"));
return S_OK;
}
What I now want to do is a bit complicated:
Before the browser is about to display the webpage I want to get access and to the document's content and modify it (e.g. for removing keywords previously defined in an external file)
I hope someone of you can help me, since it is a question which can't be explained in 1 minute.
Thanks in advance
regards
Gregor
modified 12-Sep-18 21:01pm.
|
|
|
|
|
When the DocumentComplete event is sent, a great deal of rendering is already done. This will not prevent you from modifing the document "on the fly". What I would suggest is the following:
1) QueryInterface pDisp for the IWebBrowser2 interface (or call Invoke directly)
2) Use IWebBrowser2::get_Document to get a pointer to the (Dispinterface of; QueryInterface again) IHTMLDocument2. If the document contains frames you have to find the interface for each frame, and repeat step 3 for each of them.
3) Get the body element and send it to an recursive function that handles each leaf element (gets/puts outer text). It then finds all element children and feed them back to the function.
This is just an suggestion, and perhaps someone has a better solution. Sorry if I don´t go into all technical details, but I hope this will help a little.
/moliate
|
|
|
|
|
As I recall from my prevous experience on close to that issue:
DocumentComplete Event may not be always fired... So, check Refresh for example... I recall it didn't work for me... But again, it could be previous versions of WebBrowser...
Everything else as rightly described in previous message...
GL
Igor
|
|
|
|
|
Hi, I tested the atol() function. This line works fine:
char buffer[] = "1234567890.12";
long number = atoi(buffer); // number = 1234567890;
but here is problem after I added the following lines:
buffer[10] = '\37'; // buffer = "1234567890712" now
number = atoi(buffer); // return value is 1912276760. why?
thank you very much for your advice!
|
|
|
|
|
sorr, typing error:
buffer[10] = '\37'; ==> buffer[10] = '\x37';
|
|
|
|
|
A long is a 32 bit number.
The biggest it can store is 4294967295
1234567890 < 4294967295
But
1234567890712 > 4294967295
That's why you get this overflow error.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Ah, I see. Thank you, Nish.
|
|
|
|
|
I'm trying to figure out how this beast is supposed to work to be able to show popup contextual help windows?
The tech-writter gave me a help.chm file that has a [TEXT POPUP] section in it with the text file that contains all the contextual help descriptions like :
context.txt :
.topic HID_TOPIC_DO_SOMETHING
This functionnality will do something
and context.h :
#define HID_TOPIC_DO_SOMETHING 4567
in my program I'm doing the following:
HH_POPUP popupText = { sizeof(HH_POPUP),
theApp->m_hInstance,
4567,
NULL,
{100, 100},
(DWORD) -1,
(DWORD) -1,
{-1, -1, -1, -1},
NULL
};
::HtmlHelp(m_hWnd,helpFile, HH_DISPLAY_TEXT_POPUP ,(DWORD) &popupText);
But it doesn't work really well, it doesn't work at all, I don't know exactly what happening, but the topic is not found!
Is this supposed to work ? Should it be used ? the documentation in MSDN is not really usefull, and what I could find on the web, wasn't really usefull either!
If you have any hints, tips or additional resources for this I'd appreciate !
Thanks!
Max.
|
|
|
|
|
Here is the code I use
static HWND DoHtmlHelp (HWND hwndCaller,
LPCTSTR pszFile, UINT uCommand, DWORD dwData)
{
#if !defined (_WIN32_WCE)
CWaitCursor wait;
if (hwndCaller)
{
CWindow wMain;
wMain .Attach (hwndCaller);
wMain .SendMessage (WM_CANCELMODE, 0, 0);
wMain .SendMessageToDescendants (WM_CANCELMODE, 0, 0, TRUE);
}
HWND hWndCapture = ::GetCapture ();
if (hWndCapture != NULL)
::SendMessage (hWndCapture, WM_CANCELMODE, 0, 0);
return HtmlHelp (hwndCaller, pszFile, uCommand, dwData);
#else
return NULL;
#endif
}
static HWND DoHtmlHelpPopup (LPTSTR pszHelpFile, HWND hWndCtrl, DWORD dwID)
{
#if !defined (_WIN32_WCE)
RECT rect;
::GetWindowRect (hWndCtrl, &rect);
HH_POPUP pop;
pop .cbStruct = sizeof (pop);
pop .hinst = NULL;
pop .idString = dwID;
pop .pszText = NULL;
pop .pt .x = (rect .left + rect .right) / 2;
pop .pt .y = (rect .top + rect .bottom) / 2 + 8;
pop .clrForeground = -1;
pop .clrBackground = -1;
pop .rcMargins .left = 20;
pop .rcMargins .top = 8;
pop .rcMargins .right = 8;
pop .rcMargins .bottom = 8;
pop .pszFont = NULL;
return DoHtmlHelp (hWndCtrl, pszHelpFile,
HH_DISPLAY_TEXT_POPUP, (DWORD) &pop);
#else
return NULL;
#endif
}
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
i am making a text editor and i would like a encrypt button that will change the text in a TRichEdit1 box to some form of encryption. i need a password to be entered on encryption that must be put in again to decrypt the text back to what it was
any code or sources would be greatly appreciated
thanks in advance
Steven Richardson - soveryevil@hotmail.com - you can contact me on MSN messenger at that address or email me on it
|
|
|
|
|
Perhaps you might want to use the PGP API.
Or look up "Cryptographic Functions" on MSDN
If you have trouble finding it, look for CryptEncrypt and CryptDecrypt
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
I have a project that uses the CHtmlView MFC View and I want to feed the control the html text, rather then have it get it from the web or a file. There doesn't seem to be a way to do this.
For example, I just want to display this in the CHtmlView:
<html><body><b>Hello World</b></body></html>
How can this be done?
|
|
|
|
|
http://www.codeproject.com/useritems/parse_html.asp
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Hi. I want to thank everyone who has helped me answer many of my questions. However, it seems like the questions just keep coming.
I am tryingto use Openprinter and also GetPrinter to see if a printer is offline/connected or not. However, I am having some trouble with the structure of the call.
PRINTER_INFO_2 Printer2;
GetPrinter(
hPrinter, //printer handle
2, //level 2
Printer2, // Buffer that holds the info
sizeof(PRINTER_INFO_2),
&dwNeed); //bytes still needed
However, it gives me an error about not being able to cast from PRINTER_INFO2 to unisgned char*. I also tried to allocate another buffer and type cast it manually to PRINTER_INFO_2 to try to get to the Status variable but same basic thing.
What is the problem.
Thanks in advance.
|
|
|
|
|
(char *) &Printer2
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
can any one tell me how to write a method that adds some objects to an Array.
and at the same time sort these objects using insertion sort?
thanks a lot,
|
|
|
|
|
using linked list instead of array might help.
here is some info about linked list: http://cslibrary.stanford.edu/103/LinkedListBasics.pdf
|
|
|
|