|
So how about "regsvr32 -u *.DLL"?
Regards,
Tim
|
|
|
|
|
Hi fellows
I need to insert an image in my menu. My menu is composed with the following strings: "New Text", "New File", "New Ruler".
My menu was coded with win32, not MFC.
Now the questions:
1) I've readed that I need to create owner draw menus. Is that right?
2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed.
3) What you recommend that I read to get a better understand of this topic and start coding?
Any help is very welcomed. Again thanks for the support.
|
|
|
|
|
I've used NewMenu in several projects. Excellent.
|
|
|
|
|
|
thanks man, I'll see right now...
|
|
|
|
|
I hope it solved your problem.
|
|
|
|
|
Thanks man, for your help
|
|
|
|
|
|
Hi Alex,
Since you have asked specifically for win32, I thought I should let you know the precisely steps to create Menu and answer your questions.
1) I've readed that I need to create owner draw menus. Is that right?
Its not mandatory.
2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed.
Windos fits the image accordingly. If you want text with a bmp as a menu item then again the space will be fixed for the bmp.
Steps:
HMENU Menu;
Menu = CreatePopupMenu();
HBITMAP hBitmap1 = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1));
HBITMAP hBitmap2 = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP2));
//Append
AppendMenu(Menu, MF_STRING, 2000, "Test3333333333");
AppendMenu(Menu, MF_SEPARATOR, NULL, "");
AppendMenu(Menu, MF_STRING, 2001, "Test2");
SetMenuItemBitmaps(Menu, 2001, MF_BYCOMMAND,hBitmap2, hBitmap1);
TrackPopupMenu(Menu,TPM_RIGHTALIGN,point.x, point.y,0,this->m_hWnd,NULL);
The above steps will create 2 Menu items, one only text and other bmp with text.
Manoj
Never Gives up
|
|
|
|
|
Thanks for your help manoj, very thanks....
And thanks for the code, I'll test it right now
|
|
|
|
|
Hi there,
Please specify how to decide whether to go for return codes or exception handling.
When is exception handling preferred over returning a specific error code.
Thanks in advance,
Raja Pratap
|
|
|
|
|
IMHO you need a decision between throwing an exception or returning a specific error code.
If it is as above stated, then I think:
(1) If it's your own application (entirely developed by you) then you can (almost) safely rely on return error codes, since you know that calling methods must always check the return values.
(2) If your're working in team then throw, throw, throw: never trust your mates coding neatness!!!
Hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thank you for your response Pillani.
But still I'm not clear, why return codes are not suitable when we work as team.
|
|
|
|
|
Hi,
I think it is because you can not be totally sure about what the others will do. If they get an assertion, they have to solve something, if they have a return code, they can make nothing about or even don't realize about the error. And then error will be cumulating themselves until it would be too difficult to correct the program.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Raj Prathap wrote: But still I'm not clear, why return codes are not suitable when we work as team.
Well, suppose you have a method returning failure. If the caller doesn't check the return value and continues execution, maybe some disaster is along the way. On the other hand, throwing an exception, you force the caller to handle it or, anyway, the execution will be stopped.
Now, if the caller is a member of you team (and not yourself) then there is a chance that importance of return value is underestimated.
Hope that helps
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks Pallini, That answers my question.
|
|
|
|
|
Hello everybody,
is it possible to supress also the flickering with Groupboxes?
I get it to size my views without textbox & label flickering, but the groupboxes still
fickers.
Big thanks
|
|
|
|
|
I want to insert a binary file, say "tt.bin", into a field (image type) of SQL database, I wrote a program as follows
C++, VS2003, ADO, input file: tt.bin,database: moldb,
Create table moltbl (id INT, mol IMAGE);
But I didn't get nothing in the output file: new.bin
where am I wrong, please? thanks very much!
// BLOB.cpp
#import "c:/Program Files/Common Files/System/ADO/msado15.dll" \
no_namespace rename("EOF", "EndOfFile")
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
::CoInitialize(NULL);
_RecordsetPtr m_pRecordset("ADODB.Recordset");
_ConnectionPtr m_pConnection("ADODB.Connection");
_bstr_t bstrSQL("select * from moltbl");
ifstream moldata;
moldata.open("tt.bin", ios::in|ios::binary);
ofstream newdata;
newdata.open("new.bin", ios::out|ios::binary);
char buffer[10240];
char *pBuf = buffer;
long nFileLen = 0;
if (!moldata.fail() && !moldata.eof())
moldata.read(buffer,10240);
nFileLen = moldata.gcount();
VARIANT varBLOB;
SAFEARRAY *psa;
SAFEARRAYBOUND rgsabound[1];
int index = 0;
_bstr_t strConnect = "Provider=SQLOLEDB; Server=ELSE-HP;"
"Database=moldb; uid=sa; pwd=sa";
m_pConnection->Open(strConnect, "", "", adModeUnknown);
if(m_pConnection == NULL)
cerr<<"Load data ERROR!\n";
HRESULT hr = m_pRecordset->Open("SELECT * FROM moltbl",
_variant_t((IDispatch *)m_pConnection,true),
adOpenDynamic,
adLockPessimistic,adCmdText);
m_pRecordset->AddNew();
m_pRecordset->PutCollect("id",_variant_t(index++));
if(pBuf)
{
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = nFileLen;
psa = SafeArrayCreate(VT_UI1, 1, rgsabound);
for (long i = 0; i < (long)nFileLen; i++)
SafeArrayPutElement (psa, &i, pBuf++);
varBLOB.vt = VT_ARRAY | VT_UI1;
varBLOB.parray = psa;
m_pRecordset->GetFields()->GetItem("mol")->AppendChunk(varBLOB);
}
m_pRecordset->Update();
long lDataSize =_pRecordset->GetFields()->GetItem("mol")->ActualSize;
ifstream newfile;
newfile.open("new.bin", ios::out| ios::binary);
if(lDataSize > 0)
{
_variant_t varBLOB;
varBLOB = m_pRecordset->GetFields()->GetItem("mol")->GetChunk(lDataSize);
if(varBLOB.vt == (VT_ARRAY | VT_UI1))
{
SafeArrayAccessData(varBLOB.parray,(void **)&pBuf);
newdata.write(pBuf, lDataSize);
SafeArrayUnaccessData (varBLOB.parray);
}
}
moldata.close();
newdata.close();
return 0;
}
Hi, there. Need your help!
|
|
|
|
|
Have you bothered to step through your code using the debugger to see where the problem lies?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for suggestions
I've stepped into it, and find something seems wrong at
if(pBuf)
{
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = nFileLen;
psa = SafeArrayCreate(VT_UI1, 1, rgsabound);
for (long i = 0; i < nFileLen; i++)
SafeArrayPutElement (psa, &i, pBuf++);
varBLOB.vt = VT_ARRAY | VT_UI1;
varBLOB.parray = psa;
m_pRecordset->GetFields()->GetItem("mol")->AppendChunk(varBLOB);
}
becouse when i did as follow:
m_pRecordset->Update();
long lDataSize = m_pRecordset->GetFields()->GetItem("mol")->ActualSize;
I find that the value of lDataSize is alwayse -1
do you know the reason, please?
thanks a lot
regards.
Li
Hi, there.
|
|
|
|
|
I've also posted my question in the ADO forum,
http://www.codeproject.com/script/comments/forums.asp?forumid=1725&select=2047403&msg=2047403
so, please go there if you want to help me, thanks.
best regards
Hi, there.
|
|
|
|
|
hi,
How can i read data from an excel file and write data to the cells, by just specifying the column name? how to open and close the excel file?
Thanks in advance.
SYAMLAL
|
|
|
|
|
Search for Excel Automation.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
|