|
Hi to All
Can anybody help me in this regard. i have to use vc++ to store BLOBS in Oracle Databse using ADO with or without Stored procedures.
Thanks in advance.
|
|
|
|
|
snprani wrote:
Can anybody help me in this regard. i have to use vc++ to store BLOBS in Oracle Databse using ADO with or without Stored procedures.
Looks like you have posted this question several times over the last week and no one has been able to help. I will give it a go.
Well storing images in a database is rather expensive. The one time I needed an app to store images I basically fudged it and stored the image on a disk drive and only stored the location / name of the file.
Blob columns in a db are easy to corrupt and very expensive server wise. There is away to do it but generally everything that I have found warns against it.
Here is some info off of the MSDN for using blobs and SQL server. This should be the same for oracle.
http://support.microsoft.com/default.aspx?scid=kb;en-us;185958[^]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlmag01/html/BLOB.asp[^]
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Hello All
I am developing an SDI application in VC++ 6.0 on WIndows 2000.
I want to read some settings from Database when application comes up. I wrote DB access code in "CMyView::OnInitialUpdate()". It is working fine when DB is accessable. If DB is not accessable due to some problem, my application waits in the starting itself until the DB connection is timed out... after that application displays the Error MessageBox and then the main window is launched.
User is unable to know what is going on until he gets the Error Message. I want my application to comeup first and then I want to try to access the DB and I want to put periodic status message to the user to know about what is going on in backend.
Please let me know where I can write the code for DB accesss in order to get executed after the main window is displayed. Please note that it is SDI application.
Thanks for your time
Ravi
|
|
|
|
|
//Define a user message (2008 is Beijing Olympic;P))
#define WM_DELAY_CONNECTDB WM_USER + 2008
BEGIN_MESSAGE_MAP(CXXXView, CView)
//...
ON_MESSAGE(WM_DELAY_CONNECTDB, OnDelayConnectDB)
//...
END_MESSAGE_MAP()
void CXXXView::OnInitialUpdate()
{
CView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
//Post the message here
PostMessage(WM_DELAY_CONNECTDB);
}
void CXXXView::OnDelayConnectDB(WPARAM wParam, LPARAM lParam)
{
//Begin your operation
MessageBox("Perform your connecting operation");
}
Lane
China
|
|
|
|
|
In my opinion ,I don't put code in CMyView::OnInitialUpdate()". It may be better to use a menu named "Link DataBase",
the user click the menu ,then the application link to the DB accesss. If access failed ,you can give the user an
Error MessageBox . Thus you can put the DB access code in CMyView::On****( ).
libo
|
|
|
|
|
Have you considered putting the database-access code in a separate thread? This would allow the primary thread, which owns the GUI, to remain active and responsive.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hello All
I am accessing DB using user defined message handler.
Due to more number of threads i have avoided using one more thread. But thanks for your solution.
Have nice time
Ravi
|
|
|
|
|
Hi,
I would like to create an owner draw CListCtrl in thumbnail mode. Can somebody please help me by giving some pointers in doing this. I have done owner draw list controls for the detail view, But for the icon view, I am very much confused.
Some articles or code sample would be really helpful.
Looking forward for a reply.
Thanks and Regards
San
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
I am karnal and nowadys learning Vc.
I have a problem
"I have a Dialog based MFC program via i captured Bitmap, now i want to print this captured bitmap on default network printer,
The code for capturing bitmap is as follows
-------------------------------
void WriteBmp(char* filename,BITMAP *bmp,int* data)
{
BITMAPINFO Bmi;
memset(&Bmi,0,sizeof(BITMAPINFO));
Bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
Bmi.bmiHeader.biWidth = bmp->bmWidth;
Bmi.bmiHeader.biHeight = bmp->bmHeight;
Bmi.bmiHeader.biPlanes = 1;
Bmi.bmiHeader.biBitCount = bmp->bmBitsPixel;
Bmi.bmiHeader.biCompression = BI_RGB;
Bmi.bmiHeader.biSizeImage = bmp->bmHeight*bmp->bmWidth*bmp->bmBitsPixel/8;
FILE* image = fopen (filename,"wb");
if(image==0)
return;
int h = abs(Bmi.bmiHeader.biHeight);
int w = abs(Bmi.bmiHeader.biWidth);
Bmi.bmiHeader.biHeight=h;
Bmi.bmiHeader.biWidth=w;
int sz = Bmi.bmiHeader.biSizeImage;
BITMAPFILEHEADER bfh;
bfh.bfType=('M'<<8)+'B';
bfh.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER);
bfh.bfSize=sz+bfh.bfOffBits;
bfh.bfReserved1=0;
bfh.bfReserved2=0;
fwrite(&bfh,sizeof(bfh),1,image);
fwrite(&Bmi.bmiHeader,sizeof(BITMAPINFOHEADER),1,image);
fwrite(data,sz,1,image);
fclose(image);
}
void CFullscreenDlg::OnShowWindow()
{
HANDLE hBitMap =(HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
m_bmp.m_str,IMAGE_BITMAP,0,0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION); // put here the handle of the window you would like to caputre
CBitmap bmp;
bmp.Attach((HBITMAP)hBitMap);
BITMAP bitmap;
bmp.GetBitmap(&bitmap);
int size = bitmap.bmWidth*bitmap.bmHeight*bitmap.bmBitsPixel/8;
BYTE *lpBits = new BYTE[size];
::GetBitmapBits((HBITMAP)hBitMap,size,lpBits);
WriteBmp("c:\\test.bmp",&bitmap,(int*)lpBits);
delete []lpBits;
}
-----------------------------------------------
so plz help me to solved out my printing problem.
Thanking u all
Karnal
karnal
|
|
|
|
|
How to create a .jpg file using VC++?
aasstt
|
|
|
|
|
|
I have a menu with several items, one of which is a submenu. Normally, I use Class Wizard and ON_UPDATE_COMMAND_UI to enable or disable menu items.
But I'm not able to use the same technique to gray a submenu name itself because it doesn't have a command ID associated with it. Is it possible to gray a submenu item using MFC?
Mallikarjun Avanna Lavate
|
|
|
|
|
i HAD GOT THE ANSWER.....
OnUpdateFLOWMASTERVERSION3(CCmdUI* pCmdUI)
{
// decide here whether to enable or disable pop-up menu:
if (pCmdUI->m_pSubMenu != NULL)
{
BOOL bEnable = TRUE; //if we want disable then writ false otherwise true
pCmdUI->m_pMenu->EnableMenuItem(pCmdUI->m_nIndex,
MF_BYPOSITION | (bEnable ? MF_ENABLED :
(MF_DISABLED | MF_GRAYED)));
}
}
|
|
|
|
|
Maybe it's difficult to use CmdUIUpdate.
The way I know is:
//Suppose the popup menu is the first item in the first drop-down menu.
CMenu* pMainMenu = GetMenu(); //"this" is CMainFrame
CMenu* pSubMenu = pMainMenu->GetSubMenu(0);//0 is the first window menu
pSubMenu->EnableMenuItem(0, MF_BYPOSITION | MF_GRAYED); //0 is the popup menu
Lane Yu
China
|
|
|
|
|
Hi,
I derived a CButtonEx from CButton. I implemented it as general purpose dll.
The problem is that the PreTranslateMessage is not working.
Is there any problem with PreTranslateMessage and a dll?
- NS -
|
|
|
|
|
According to MS, a custom DLL that is statically linked to the MFC library needs to have a CWinApp-derived class and a single object of that application class, as does an executable MFC application. The CWinApp object of the DLL, however, does not have a main message pump, as does the CWinApp object of an application. If the DLL opens modeless dialogs or has a main frame window of its own, the application's main message pump must call a routine exported by the DLL, which in turn calls the CWinApp::PreTranslateMessage member function of the DLL's application object.
See coding example and more info on the topic here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/html/_sample_mfc_dlltrace.asp[^]
SkyWalker
|
|
|
|
|
Thank you.
Does it mean that we can't write a stand alone button control (library) using dll (that is without processing the message specially for the button in the application)?
- NS -
|
|
|
|
|
You can write whatever dll you want
I would recommend you using the following:
<br />
Overwrite the PreTranslateMessage()for your window derived class (whatever that may be):<br />
BOOL CDllWnd::PreTranslateMessage(MSG* pMsg)<br />
{<br />
if (IsDialogMessage(pMsg))<br />
return TRUE;<br />
<br />
return CWnd::PreTranslateMessage(pMsg);<br />
}<br />
-----------<br />
Export then a function<br />
extern "C" DllExport BOOL FAR PASCAL FilterDllMsg(LPMSG lpMsg)<br />
{<br />
AFX_MANAGE_STATE(AfxGetStaticModuleState())<br />
TRY<br />
{<br />
return AfxGetApp()->PreTranslateMessage(lpMsg);<br />
}<br />
END_TRY<br />
<br />
return FALSE;<br />
}<br />
-----------<br />
In user application: <br />
BOOL CYours::PreTranslateMessage(MSG* pMsg)<br />
{<br />
if (CTheBaseClass::PreTranslateMessage(pMsg))<br />
return TRUE;<br />
<br />
return FilterDllMsg(pMsg);<br />
}<br />
SkyWalker
-- modified at 6:53 Monday 3rd October, 2005
|
|
|
|
|
|
In my application i want to have a sys tray icon which has a Menu like
A
B
C --> C.1
C.2
C.3
D --> D.1
D.2
D.3
E --> E.1
E.2
A and B do not have pop-ups and are present to invoke some defined shortcuts
In my resource editor I have created a MEnu resource having the following
A
B
C
D
E
F
Elements for C , D and E and added and removed at run-time .
I want to be able to create functionality to be add the same . I was unable to find any routines where I would be able to add a CMenu (for say menu containing C.1 ,C.2 etc) to an existing CMenu(GetSubMenu(0)) .
Please help
THanks
-- modified at 21:58 Sunday 2nd October, 2005
|
|
|
|
|
is there a way to simulate a hardware interrupt in C++? i want to generate an interrupt for lets say mouse movement or keyboard press. is this possible?
thanks!
|
|
|
|
|
|
I'd like to create a program that will send a file (.txt) to its server. I came across articles regarding TCP/IP, Socket, WinSock, etc.. Which of these do I have to focused into in creating a simple server/client connections? of course these methods have their own advatages/disadvantages or limitations. There's a NDK program/article here in codeproject but I don't know if I'll just use it or better create network programming on my own.
One more thing, is it possible for a program to detect if the computer it currently resides into is the server or the client? So that my program will automatically shift into server mode/client mode depending where it is being launched. Thanx
|
|
|
|
|
For simple network comunication any article on Socket or Winsock should be enough.
If you want to indentify the current computer you can use gethostname() and then gethostbyname() if you want the IP address.
|
|
|
|
|
Look try to study and use the
socket , it the basic element
for networking.CSocket is a
usefull class provided by VC.
If u have defined the port range
say from 7000 to 8000 . Then u
can try connecting to it as a
Client .If there is successfull
connection then u can know that
the opposite machine is a Server
else it is Client .The program
just have to use a FOR loop.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|