|
Did you include Wininet.h ?
|
|
|
|
|
ya i have. I have also included lib file( Wininet.lib )but still its giving this error
|
|
|
|
|
Whats your type application and your compiler?
|
|
|
|
|
|
i have a quicker and temporary solution for you.
but not sure, weather it suits your application.
1.go to command prompt and type ipconfig.
2.you will see the ip settings.
3.next, disable the internetconnection and see ipconfig.
4.in my system, it gives win 2000 ip configuration, and that should apply for your system also.
5.so got the difference?
apart from your code which you have previoulsy executed, you can add this ipconfig in a systemcommand (obviously by redirecting the output to a file)
and see weather the connection is enabled or not.
and one more alternative is,
you can google to find some application,(which i studied few days ago) like "how to find the unique ID of the network card in the computer"
in this application, the function returns the ID if the network is enabled
i think this will also be helpful, until some master gives you a simple technique. even iam eagerly waiting for that.
gud luck.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
Hi all,
At runtime how to draw a transparent rectangle on the bitmap, which is loaded from the file using memory DC.
thanks in advance
|
|
|
|
|
surezu wrote: draw a transparent rectangle
Here try the following code:
void DrawTransparentRectangle( CDC& dc, Rect rc)
{
// the next line draws a transparent rectangle
// there now can you see it?
// i'm sure it is there, look again
}
|
|
|
|
|
Ha! I can see right through your reply
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
what is the problem u r facing right now?
if u r problem is that u r rectangle drawn with Rectangle()masks u r bmp then draw 4 lines simple.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
i'm having a CBitmap object, which will contain 2546x3288 size image,loading from bmp file.i need to draw a rectangle on that image witout lossing of background image...
void SFormViewer::OnPaint()<br />
{<br />
CPaintDC dc(this);
<br />
if(flag_iInitPaint)<br />
{<br />
CRect rClient;<br />
GetClientRect(&rClient);<br />
<br />
CPen m_Pen;<br />
m_Pen.CreatePen(PS_SOLID,2,RGB(250,0,0));<br />
<br />
CDC m_memDC;<br />
m_memDC.CreateCompatibleDC(&dc);<br />
m_memDC.SelectObject(&m_FormImage);<br />
m_memDC.SelectObject(&m_Pen);<br />
m_memDC.SetBkMode(TRANSPARENT);<br />
<br />
r_SelectedRect.SetRect(m_iShownImgTopX + p_iTopLeft.x, m_iShownImgTopY + p_iTopLeft.y, m_iShownImgTopX + p_iBottomRight.x, m_iShownImgTopY + p_iBottomRight.y);<br />
<br />
if(flag_Scroll == 0)<br />
{<br />
m_memDC.Rectangle(r_SelectedRect);<br />
<br />
}<br />
<br />
dc.BitBlt(0,0,rClient.Width(),rClient.Height(),&m_memDC,m_iShownImgTopX,m_iShownImgTopY,SRCCOPY);<br />
<br />
}<br />
}
|
|
|
|
|
surezu wrote: r_SelectedRect.SetRect(m_iShownImgTopX + p_iTopLeft.x, m_iShownImgTopY + p_iTopLeft.y, m_iShownImgTopX + p_iBottomRight.x, m_iShownImgTopY + p_iBottomRight.y);
if(flag_Scroll == 0)
{
m_memDC.Rectangle(r_SelectedRect);
}
what i suggest is, instead of using memDC.rectangle,
use like this.
say if you want to draw rectangle from (x1,y1) to (x2,y2)
moveto(x1,y1);
lineto(x2,y1);
moveto(x2,y1);
lineto(x2,y2);
moveto(x2,y2);
lineto(x1,y2);
try to guess the next part of the code.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
chandu004 wrote: what i suggest is, instead of using memDC.rectangle,
Why is 8 lines of code better than 1?
Inquiring minds want to know...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Rectangle draws a rectangle filled with the current selected brush.
Try selecting a null/hollow brush into the memDC instead of setting the background
mode to transparent
CBrush HollowBrush;
HollowBrush.CreateStockObject(HOLLOW_BRUSH);
CBrush *pOldBrush = m_memDC.SelectObject(&HollowBrush);
...
<draw your rectangle>
...
m_memDC.SelectObject(pOldBrush);
It's also a good idea to get into the habit of saving objects
previously selected into DCs so you can select them back in
when you're done with the DC. This will prevent resource leak problems.
Also....what happens if the bitmap isn't compatible with the memDC??
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
See Graphics::DrawRectangle on the MSDN.
|
|
|
|
|
Can any body help me to access printer in VC++
Thanks in advance
|
|
|
|
|
1) Click the top left corner of the page where it has the Bob Image and says "The Code Project"
2) After the home page loads look in the left column for the black bar that says "Sections"
3) Under Sections look for "General C++" and click it. That will open a new list of choices
4) Click "Printing"
Good luck
|
|
|
|
|
if you want to print you can use of StartDoc EndDoc for get name of printers see EnumPrinters .
|
|
|
|
|
Hi All,
I am using MFC Application.I am going to include Existing project in to my Project's Workspace.
I have new project of type static library OK.Noew I got problem when I am going to include header file of that new project in my MFC project's class.I got error like below.......
1>d:\testing_and_download\testing\testrtmp_working\testrtmp\rtmpdesk.h(2) : fatal error C1083: Cannot open include file: 'omnithread.h': No such file or directory
Here,
omnithread is my new project and in that I have omnithread.h file.In this project I have used the thread classes which i want to access here in my MFC project.
Ok. Thanks In Advance.
Ashish
|
|
|
|
|
use Full path or absolute path
like "..\\newprojectfoldername\\omnithread.h"
|
|
|
|
|
When I give the full path then it gives the error like...........
1>d:\testing_and_download\testing\testrtmp_working\testrtmp\omnithread\omnithread.h(137) : fatal error C1189: #error : "No implementation header file"
And I hope It comes from omnithread.h file in which I have defined like..........
****************************************************
#if defined (_OMNITHREAD_DLL) && defined(_WINSTATIC)
#error "Both _OMNITHREAD_DLL and _WINSTATIC are defined."
#elif defined(_OMNITHREAD_DLL)
#define _OMNITHREAD_NTDLL_ __declspec(dllexport)
#elif !defined(_WINSTATIC)
#define _OMNITHREAD_NTDLL_ __declspec(dllimport)
#elif defined(_WINSTATIC)
#define _OMNITHREAD_NTDLL_
#endif
// _OMNITHREAD_DLL && _WINSTATIC
#else
// Not using MSVC++ to compile
#define _OMNITHREAD_NTDLL_
#endif
// _MSC_VER
#elif defined(__sunos__) && (__OSVERSION__ == 5)
#ifdef UsePthread
#include <omnithread posix.h="">
#else
#include <omnithread solaris.h="">
#endif
#elif defined(__linux__)
#include <omnithread posix.h="">
#elif defined(__nextstep__)
#include <omnithread mach.h="">
#elif defined(__VMS)
#include <omnithread posix.h="">
#elif defined(__SINIX__)
#include <omnithread posix.h="">
#elif defined(__osr5__)
#include <omnithread posix.h="">
#elif defined(__irix__)
#include <omnithread posix.h="">
#else
#error "No implementation header file" ///////////ERROR Message Is like this
#endif
******************************************************************
Sorry for big code but I hope error comes from here and I have no that to much idea about this definition.
Thanks Hiru.
Ashish
|
|
|
|
|
|
The data packets received from NIC may have Indefinite length,and among the data may include '\n','\t','\0',and so on .
If I do not want to new and delete a char ** every time according to the size of data packet , are there any advanced tools or structurs can be used? Thanks for your help~
Never to say never~
|
|
|
|
|
can you put your question more clearer?
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
Michel_Huang wrote: are there any advanced tools or structurs can be used?
Yes, and guess how they work? They will new and delete heap memory every time according to the size of data packet. Standard Template Library[^]
|
|
|
|
|
ye~ I see ,thank you ~
Work hard. Laugh often. Keep your honor. Never to say never
|
|
|
|