|
What will happen if I want to create a Socket giving it the IP of the machine where my program is not running. Will it be allowed or be nor allowed due to security. Actually, I want to communicate between two machine through Sockets .... but one machine runs on LAN and other is connected to Internet through direct modem ...
|
|
|
|
|
I doubt it would be allowed to do that way.
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Ibraheem Khan wrote:
Actually, I want to communicate between two machine through Sockets .... but one machine runs on LAN and other is connected to Internet through direct modem ...
If you really want to communicate between two, you need Aa static IP and your ISP providing you support for connecting to that IP!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I have created an SDI app and have drawn certain things on to the main window (lines, rectangels etc..). I would now like ot take that data, scale it down, and save it in a bitmap file. Is there a convenient way to simply take whatever the Redraw function does and make it draw the same thing on to a bitmap?
-bk
|
|
|
|
|
|
You need to create a memory bitmap at first and then drawing it on this memory bitmap,when finished,please convert CBitmap to bitmap file,I think the following sample codes to be useful to you (You cann't build it,it is only a sample):
BOOL CMyCanvasCore::DoDrawImage(CImage* pImage, CDC* pDC)
{
BOOL bSuccess = FALSE;
CDC dcMem;
CBitmap bmp;
CDC dcScreen;
dcScreen.Attach(::GetDC(0));
if (pDC == NULL)
{
pDC = &dcScreen;
}
dcMem.CreateCompatibleDC(pDC);
CRect rcVirtual(GetVirtualOrigin(), GetVirtualSize());
CSize szBitmap(rcVirtual.Width(), rcVirtual.Height());
PrepareDrawDC(pDC, FALSE);
pDC->LPtoDP(&szBitmap);
BOOL bBmpCreated = bmp.CreateCompatibleBitmap(pDC, szBitmap.cx, szBitmap.cy);
if (bBmpCreated)
{
dcMem.SelectObject(&bmp);
const CPoint ptOldLogOrg = GetLogOrigin();
CRect rcMargins;
GetMargins(rcMargins);
CSize szMargins(rcMargins.left, rcMargins.top);
FODPtoLP(&szMargins);
CPoint ptTopLeft(GetVirtualOrigin());
ptTopLeft.x += szMargins.cx;
ptTopLeft.y += szMargins.cy;
SetLogOrigin(ptTopLeft.x, ptTopLeft.y);
PrepareDrawDC(&dcMem, FALSE);
// Draw background.
DoDrawBackGround(&dcMem,rcVirtual);
GetCurrentModel()->OnDrawShapeNormal(&dcMem);
SetLogOrigin(ptOldLogOrg.x, ptOldLogOrg.y);
// pImage->MakeNewBitmap(&dcMem, &bmp);
bSuccess = TRUE;
}
dcScreen.Detach();
return bSuccess;
}
Jack
---------------------------------------------------------------------------------
XD++ MFC/C++ Flow/Diagram Library -- http://www.ucancode.net
|
|
|
|
|
|
I need to emulate Windows Task Manager CPU Usage and history applets and am lost on what where i should begin - any suggestions ? How would i create the freq bar - etc.
thanks
|
|
|
|
|
You can find a bunch of charting controls here[^]. Of course, you still need to first get at the information you want to display.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Using Win32, I need to "clip" a window - that is, draw only part of a window. I don't actually draw the window myself, but I wish to put it into a "clipping" region. An analogy would be the way a child MDI window can be clipped by it's parent.
Thanks for any help,
Rich
ps - if responding by email, remove the xxx from the middle of the email address.
|
|
|
|
|
I have some problem with simple code:
There is a secondary thread that create an object this object have the method above
bool AccDatabase::Insert(Articolo* m_pArticolo)
{
char *sql = (char*) malloc( 1024 );
sprintf( sql, "//insert etc");
try {
m_pDatabase->Execute( sql );
free( sql );
return true;
}
catch (CDaoException *e){e->Delete();}
return false;
}
if i create this object in the secondary thread and call on it the metod insert i have an error of NullSystemException while if i create the object in main thread and i call on it the metod insert i have no error and the execution is ok...
where is the matter?
Tnx
|
|
|
|
|
Probably whatever 'm_pDatabase' points to should also be created on the secondary thread.
When I did DAO work, I always did ALL the database work on the secondary thread, and it works fine.
|
|
|
|
|
yes the object have a pointer to CDaoDatabase but in main thread i check if db exist (if not db will be created) but in any case i close the connection... in the secondary thread i created a new object and i do a new connection
|
|
|
|
|
What method did you use to create the secondary thread? AfxBeginThread or otherwise?
|
|
|
|
|
I use AfxBeginThread
BOOL CProvaDlg::OnInitDialog(){
...
AccDatabase* pAccDatabase = new AccDatabase();
if (pAccDatabase->Open()){ //local db already exist
}
else{
//local db does not exist
//create it
pAccDatabase->Create();
}
pAccDatabase->Close();
delete pAccDatabase;
m_pThreadSynchronize = AfxBeginThread(ThreadFunc, m_pAccDatabase);
...
}
UINT CProvaDlg::ThreadFunc(LPVOID pParam){
AccDatabase* pAccDatabase = new AccDatabase();
pAccDatabase->Open();
// do something with pAccDatabase like insert, delete ecc...
...
}
AccDatabase.h:
public:
AccDatabase(void);
~AccDatabase(void);
void Close();
bool Create();
bool Open();
bool Insert(Articolo* m_pArticolo);
bool Delete(Articolo* m_pArticolo);
bool Select(Articolo* m_pArticolo);
bool SelectAllToInsert(void);
Articolo* getNext(void);
bool SelectAllToUpdate(void);
bool SelectAllToDelete(void);
bool SetAllToSynchronize(void);
bool Update(Articolo* m_pArticolo);
private:
CDaoRecordset* m_pRecordset;
bool bFirstRecord;
CDaoDatabase* m_pDatabase;
CDaoQueryDef* m_pQueryDef;
};
|
|
|
|
|
I am concerned the problem might lie with the Articolo* m_pArticolo passed into each function. Make sure these items are also created within the same thread as the one accessing the database. When I used the DAO, I only had to make sure that all the objects used to access the database were made from within the same thread. I could connect, open, close, and execute all from within that same thread with no problem.
|
|
|
|
|
the error is in open
the code does not arrive to execute insert
|
|
|
|
|
I was reading MSDN some more on this. Maybe since the DAO object is created in the separate thread, but you don't supply arguments, it tries to use the DAOWorkSpace from the primary thread as the default. Maybe you also need to create a DAOWorkSpace in the secondary thread and explicitly use it during the Open call. I am running out of suggestions, so I hope this most recent one helps!
|
|
|
|
|
Hi
I'm opening a file using:
ofstream FicNet; //variable pour écriture de fichier
FicNet.open ( "nomFichier", ios::out);
if (FicNet.fail())
{
exit(2);
}
else
{
FicNet << "! "<
|
|
|
|
|
Why open it first? Can't you just use CopyFile() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi
I'm opening a file using:
ofstream FicNet; //variable pour écriture de fichier
FicNet.open ( "nomFichier", ios::out);
if (FicNet.fail())
{
exit(2);
}
else
{
FicNet << "! "<
|
|
|
|
|
Take a look at the GetSaveFileName() function in the Win32 platform SDK on MSDN.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
can anybody solve my problem!
i am getting header information of shape file but i dont know how to convert big endian byte order data to little endian byte order.
|
|
|
|
|
|
sorry i cant understand what u say?
|
|
|
|