|
PLease see the IHtmlDocument2 interface in the MSDN you can find all the methods which are exposed by this interface.
Cheers
"Peace of mind through Technology"
|
|
|
|
|
Joseph Lee wrote: Could you suggest any briliant idea to make this simple & fast?
You may required to write plugin for IE which keep track of webpages.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hello everyone,
Im displaying a captured image onto the the screen. I use the following code to display the image.
<br />
void draw()<br />
{<br />
if(m_imageData == NULL)<br />
return;<br />
glPixelStorei(GL_UNPACK_ALIGNMENT,1);<br />
glRasterPos2i(m_xOffset,m_yOffset);<br />
glDrawPixels(m_width,m_height,GL_RGBA,GL_UNSIGNED_BYTE,m_imageData);<br />
glFlush();<br />
}<br />
the fuction draws the image ok but the glDrawPixels function creates a memory leak. Does anyone know a work around glDrawPixels or a way to track the memory leak (don't know if it's possible on my end since it's a openGL function).
Thank's everyone
|
|
|
|
|
I am trying to change colors using variables in the initialization of a RGB command. The following are the commands used in MFC/Visual C++ 6.0:
int a = 200;
int b = 180;
int c = 125;
CMainFrame::CMainFrame()
{
//Set color frame
colorbar.CreateSolidBrush(RGB (a, b, c));
}
void CMainFrame::OnPaint()
{
CPaintDC dc(this);
CRect rc(100,150,150,200);
a = 140;
dc.FillSolidRect(&rc,RGB(a,b,c));
}
No matter what I set a to, it always displays with the original value for color. Is there a way to change the RGB colors after initialization? Please let me know at sid_kraft@msn.com. Thanks in advance, Sid Kraft
Sid
|
|
|
|
|
Seems this will work properly. check for local definitions of variable 'a'
You always filling a rectangle with a value 140,180,125
the how you could track the difference?
When filling a solid rectangle, you don't need to create teh solid brush.
the brush you have created is not selected by any dc. so if you are not using that, remove the same.
SaRath.
"Don't Do Different things... Do Things Differently..."
Understanding State Pattern in C++
|
|
|
|
|
a rectangle with green color(almost) of course OnPaint in
CSDIView::OnPaint()
whitesky
|
|
|
|
|
I wrote a Wizard page using PropertySheet, and a manifest file under XP.But when I run it under Windows vista, the header of wizard doesn't display. then, I remove the manifest file, the header display correctly. So I want to why?and if I don't remove the manifest file, how can I modify it?
Thank you very much.
|
|
|
|
|
Does anyone know how to create a thread using an unmanaged class?
|
|
|
|
|
CreateThread/Ex
AfxBeginThread
CWinThread
|
|
|
|
|
led mike wrote: CreateThread/Ex
is not thread safe. Use _beginthreadex instead.
- It's easier to make than to correct a mistake.
|
|
|
|
|
Jun Du wrote: CreateThread/Ex is not thread safe.
Huh?
|
|
|
|
|
Jun Du wrote: is not thread safe. Use _beginthreadex instead.
IF you use certain functions in the CRT, then you should use _beginthreadex . However, if you use only Win32 calls and other functions in CRT, then CreateThreadEx is perfectly fine. (As a rule, if I use any of the CRT, I use the former function, but I have used the latter in production code.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
If we are using Win32 APIs only, then CreateThread would be good enough but if we are using any CRT function that requires tiddata structure, it is must to use _beginthreadex function. Otherwise memory leak will occur because CloseHandle, corresponding to CreateThread API, won't free the dynamically allocated tiddata structure.
There is one more problem related to SEH frame.
For better understanding, please go through following link:
http://www.microsoft.com/msj/0799/Win32/Win320799.aspx
|
|
|
|
|
That's what I said. (Not all CRT functions require the local data, but knowing which ones do and which ones don't isn't generally worth the effort.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Jun Du wrote: is not thread safe. Use _beginthreadex instead.
Who said this?????
SaRath.
"Don't Do Different things... Do Things Differently..."
Understanding State Pattern in C++
|
|
|
|
|
Using CreateThread is not thread safe, not because CreateThread is not thread safe itself, but because using it in applications linked with a CRT (C/C++ Run-Time) library is not. Some notable items:
1) The applications built on VC++ 6, regardless of type, have been linked to one of the CRT libraries shiped with VC++:
Single-Threaded (default)
Multithreaded
Multithreaded DLL
Debug Single-Threaded
Debug Multithreaded
Debug Multithreaded DLL
You could avoid calling CRT functions in your module, but you have no control over who, where and when CRT is used in the application.
2) For multithreaded C/C++ to work properly, a data structure must be created and associated with each thread that uses CRT functions. CreateThread is an OS call, but _beginthreaded is a CRT call. If you call CreateThread, OS doesn't know:
- your application is written in C/C++,
- you are calling functions that aren't natively thread-safe
- it needs to allocate a CRT data block for the new thread
When you call _beginthreaded, CRT knows and handles all these in a proper manner. Then, CRT calls CreateThread inside _beginthreaded to actually create the thread you wanted.
Jeffery Richter's classic text "Programming Applications for Microsoft Windows" (4th Ed.) Chapter 6 has explained this in more detail.
- It's easier to make than to correct a mistake.
|
|
|
|
|
I'm using a CButton with the BS_BITMAP flag to draw a simple bitmap button.
I load the bitmap like this :
m_hBitmap = (HBITMAP) ::LoadImage(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDB_MY_BITMAP ),
IMAGE_BITMAP, 20, 18, LR_LOADMAP3DCOLORS );
to draw it "transparent" on the button.
and set the bitmap like :
m_Button.SetBitmap( m_hBitmap );
This works well, EXCEPT when the button is disabled; when enabled, the transparent part is "transparent", and the non-transparent part display nicelly.
When the button is disabled, the WHOLE bitmap is drawn as a dark gray rectangle.
Is there a solution to that ? I would like the disable state ( that is computed automatically ) look like what disabled buttons on toolbars look like.
Also, The LoadImage with the LR_LOADMAP3DCOLOR flag seems to be working on Win2K, but when I try my application on WinXP the color substitution does not seem to be working fine, the bitmap background is not the same as the button color.
Is there a known issue with LoadImage on XP or with BS_BITMAP ?
Thank you all.
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote: Is there a solution to that ?
What about DrawState(..., DST_BITMAP | DSS_DISABLED) ?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I'm have a problem using the Win32 WriteConsole() function. It's just printing random characters, but I'm not getting any compiler errors. Can you take a look?
Client code:
<br />
MainWindowManagement MainConsole;<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
MainConsole.SwitchBuffers(1);<br />
MainConsole.WriteStreamBuffer1<<"It dosen't work!\n";<br />
MainConsole.WriteStreamBuffer2<<"No sh*t!\n";<br />
MainConsole.WriteStreamToBuffer(1);<br />
MainConsole.SetBufferCursorPos(2, 20, 20);<br />
MainConsole.WriteStreamToBuffer(2);<br />
MainConsole.SwitchBuffers(2);<br />
cin.get();<br />
<br />
return 0;<br />
}<br />
Specification file for higher level class (directly below):
<br />
class MainWindowManagement<br />
{<br />
public:<br />
MainWindowManagement();
MainWindowManagement(string NewWindowTitle);
void WriteStreamToBuffer(int BufferNum); :sigh:<br />
void SwitchBuffers(int BufferNum);
void SetWindowFillColor(PrintColorType NewFillColor);
void SetBufferTextColor(int BufferNum, PrintColorType NewTextColorFore, PrintColorType NewTextColorBack);
void SetBufferCursorPos(int BufferNum, int NewX, int NewY);<br />
void SetWindowTitle(string NewWindowTitle);
void SetWindowSize(int NewX, int NewY);
void SetBufferSize(int NewX, int NewY);
string ReturnCurrentWindowTitle() const;<br />
PrintColorType ReturnCurrentFillColor() const;<br />
PrintColorType ReturnCurrentTextColor() const;<br />
stringstream WriteStreamBuffer1;
stringstream WriteStreamBuffer2;
protected:<br />
MainWindowSpecs ConsoleBuffer1;<br />
MainWindowSpecs ConsoleBuffer2;<br />
Win32WindowInfo MainConsoleWindowInfo;<br />
private:<br />
int CurrentlyActiveBuffer;<br />
};<br />
Upper level write function:
<br />
void MainWindowManagement::WriteStreamToBuffer(int BufferNum)<br />
{<br />
switch(BufferNum)<br />
{<br />
case 1 : ConsoleBuffer1.WriteBuffer(WriteStreamBuffer1);<br />
break;<br />
case 2 : ConsoleBuffer2.WriteBuffer(WriteStreamBuffer2);<br />
break;<br />
default : cerr<<"Client error. Invalid buffer number [1,2]."<<endl;<br />
break;<br />
}<br />
}<br />
Specification file for lower level class:
<br />
class MainWindowSpecs<br />
{<br />
public:<br />
MainWindowSpecs();
Win32StandardHandles ReturnHandles() const;
bool ReturnHandleErrorState() const;
void WriteBuffer(stringstream &TextToWrite);
void RefreshHandles();
void SetBufferInfo(int NewXCord, int NewYCord, PrintColorType ForeColor, PrintColorType BackColor, SetBufferType BufferAction);
void RefreshBufferInfo();
void SetToActiveBuffer();
CONSOLE_SCREEN_BUFFER_INFO ReturnConsoleBufInfo();
protected:<br />
private:<br />
int SetBufferInfoSetFont(PrintColorType ForeColorToSet, PrintColorType BackColorToSet);
bool StdHandleErrorState;
Win32StandardHandles StandardHandles;<br />
CONSOLE_SCREEN_BUFFER_INFO ConsoleBufInfo;<br />
};<br />
The lower level WriteBuffer() function:
<br />
void MainWindowSpecs::WriteBuffer(stringstream &TextToWrite)<br />
{<br />
DWORD NumCharsWritten;<br />
string Text;<br />
<br />
Text = TextToWrite.str();<br />
<br />
WriteConsole(StandardHandles.hOut, &TextToWrite, Text.length(), &NumCharsWritten, NULL); :mad:<br />
if(Text.length() != NumCharsWritten)<br />
cerr<<"All characters were not written."<<endl;<br />
}<br />
|
|
|
|
|
CoffeeAddict19 wrote: WriteConsole(StandardHandles.hOut, &TextToWrite, Text.length(), &NumCharsWritten, NULL);
Does this output correctly:
WriteConsole(StandardHandles.hOut, "Hello World", 11, &NumCharsWritten, NULL);
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yes it does. It still doesn't print out the stream when I switch it back to the origional code though.
|
|
|
|
|
In the WriteBuffer() method, does TextToWrite and Text contain the correct value?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello. I'm a absolute beginner at programming, but have a final class project that I'd like to begin working on nice and early. What I'd like to build is a Visual C++ program that will:
1. Take user input from a windows gui (text boxes, drop down menus, etc.)
2. Insert the input into the appropriate locations in existing html templates
3. Create new html pages based on the templates that have the users input added
4. Save the page(s) within a folder named something the user chooses, and have this folder located in a "projects" or "websites" directory where they can then access the folders/files and upload them to their server.
During this process the existing templates should not be overwritten either.
I've been able to create a very basic html page from console input using <ofstream> and "getline", but it requires mixing all the html tags with the c++ in the .cpp file. It's just messy and cumbersome. I know there must be a more efficient and elegant way of doing this that keeps the html separate from the c++, but at my beginner level I just don't know where to start. Hopefully someone here will have some insight and can give me some tips.
Thanks in advance.
-- modified at 15:37 Tuesday 13th June, 2006
|
|
|
|
|
Have you learned about SDI and/or MDI document view architecture yet?
There are several classes that deal with this.
Document Templates:
- CSingleDocTemplate
- CMultiDocTemplate
Views:
- CRichEditView (CRichEdit)
- CEditView (CEdit)
- CHtmlView (WebBrowser control)
Using, for example, the CRichEditView class you can open a file (text) regardless of the extension (.txt,.html,.xml), and load the file in the view. You can then edit it and "save as" a different filename.
mytmpl.html --> index.html
Using the CDocument class you can programatically save the document as a different name. I wouldn't get too far a head of the class though. You may be learning this near the end of the class anyway.
Mark
|
|
|
|
|
Hi want to know how to open a txt file in NotePad.exe using a button in my C++ app
and i want to know how can i read the current time/date and put them in a CString
Thans
|
|
|
|
|