|
Hi,
I already mentioned in my post i tried with vs2005..i want to get menu text when the user clicks any menu item in vs2005.
i am working with vc++6.0...please help me how to do this?
|
|
|
|
|
I suspect VS has non-standard menus (like Office….). I would use Spy++ (comes with Visual Studio) to see what messages ARE generated when you select a menu item.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
use this function for get the menu item text,
GetMenuString();
Copies the label of the specified menu item to the specified buffer.
int GetMenuString(
UINT nIDItem,
LPTSTR lpString,
int nMaxCount,
UINT nFlags
) const;
int GetMenuString(
UINT nIDItem,
CString& rString,
UINT nFlags
) const;
Regards,
Srinivas
|
|
|
|
|
I have installed mysql on my PC and created a database (sysops).
But I don't know how to connect and open the database.
I know how to use remote mysql, host (www...), user-name, password, database neme..,
What are connect info for local mysql?
Please help if you have experiences.
|
|
|
|
|
host is localhost or 127.0.0.1, rest all you should know.
-Saurabh
|
|
|
|
|
Rest all you should know.
---------------------
I don't know.
Do you mean I need to create a user and password for the created mysql database?
|
|
|
|
|
Well you said you know how to connect to remote SQL so I assumed that you know about all parameters except host name.
No you dont necessarily have to create a separate user and password for every database. You can create a user in MySql and then assign it permissions to access a database. You can download MySql Gui Tools[^] to easily create users and databases.
-Saurabh
|
|
|
|
|
Hi All
how to create new bitmap ?
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
By selecting 'New' from the file menu.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
Please provide a bit more information about what you mean because otherwise we won't be able to help.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
i have one image file which contains 5 buildings ..i want to cut and save only the 5th building ,other four buildings are not shown in the image.
but when we are save the image 5th building not shown other four buildings are shown in the image...
this is my code snippet::
<code>
HDC pDC=::GetDC(0);
HDC TmpDC=CreateCompatibleDC(pDC);
CImage _image;
_image.Load(_T("//read.tif"));
int width=_image.GetWidth();
int height=_image.GetHeight();
HGDIOBJ TmpObj2 = SelectObject(TmpDC,(HGDIOBJ)(HBITMAP)_image);
Rectangle(TmpDC, 0,0, width/2, height/2 );
SelectObject(TmpDC,TmpObj2);
_image.Save( _T("D:\\newy.jpg"), Gdiplus::ImageFormatBMP);
::ReleaseDC(NULL,pDC);
</code>
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
So let me get this right, you open a tif file, draw a rectangle on it that is suposed to overlap some part of the picture and then you save the image to another file, right? (Btw why do you specify Gdiplus::ImageFormatBMP for the Save call while you are trying to save a jpg?) Your problem is that not the part of the image is overlapped you want? Why don't you move the rectangle then?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
how to create one rectangle piece of image from existing image??
this is doubt
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
Ah well, create a new bitmap in memory with the required size, blit from the source image to the target image the part you want to cut out and then save this new bitmap.
So something like this:
HDC pDC=::GetDC(0);
HDC TmpDC=CreateCompatibleDC(pDC);
CImage _image;
_image.Load(_T("//read.tif"));
int width=_image.GetWidth();
int height=_image.GetHeight();
HGDIOBJ TmpObj2 = SelectObject(TmpDC,(HGDIOBJ)(HBITMAP)_image);
int newWidth = width/2;
int newHeight = height/2;
HDC NewDC = CreateCompatibleDC(TmpDC);
HBITMAP NewBitmap = CreateCompatibleBitmap(TmpDC, newWidth, newHeight);
HGDIOBJ NewTmpObj = SelectObject(NewDC, NewBitmap);
BitBlt(NewDC, 0, 0, newWidth, newHeight, TmpDC, 0, 0, SRCCOPY);
SelectObject(NewDC, NewTmpObj);
DeleteDC(NewDC);
SelectObject(TmpDC,TmpObj2);
::ReleaseDC(NULL,pDC);
CImage newImage;
newImage.Attach(NewBitmap);
newImage.Save( _T("D:\\newy.jpg"), Gdiplus::ImageFormatJPEG);
DeleteObject(NewBitmap);
I am not saying this code works or if it compiles at all, but it can be a starting point for you to get the idea, good luck.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi,
I saw (from your posts) that you are using CImage class. So if you need to copy the loaded image to the new one you can use the BitBlt() method of CImage .
Here is the code fragment to create a copy of given original image:
CImage imageOriginal;
imageOriginal.Load(_T("Here is the path to your original image"));
CImage imageNew;
imageNew.Create(imageOriginal.GetWidth(), imageOriginal.GetHeight(), imageOriginal.GetBPP());
imageOriginal.BitBlt(imageNew.GetDC(), CPoint(0,0));
imageNew.ReleaseDC();
....
The above example makes an exact copy of the loaded image.
If you need to copy the specific part of the loaded image, for instance a rectangular part, then you can use the BitBlt() method again, but this time the code could be something like this:
CImage imageOriginal;
imageOriginal.Load(_T("Here is the path to your original image"));
CRect rectCopy(0, 0, imageOriginal.GetWidth() / 2, imageOriginal.GetHeight() / 2);
CImage imageNew;
imageNew.Create(rectCopy.Width(), rectCopy.Height(), imageOriginal.GetBPP());
imageOriginal.BitBlt(imageNew.GetDC(), rectCopy, rectCopy.TopLeft());
imageNew.ReleaseDC();
I hope this helps!
Nuri Ismail
|
|
|
|
|
CImage imageOriginal;
imageOriginal.Load(_T( "read.tif" ));
<code>CRect rectCopy(9177,68, 10566, 635);</code>
CImage imageNew;
imageNew.Create(rectCopy.Width(), rectCopy.Height(), imageOriginal.GetBPP());
imageOriginal.BitBlt(imageNew.GetDC(), rectCopy, rectCopy.TopLeft());
imageNew.Save(_T("D://imgnew.jpg"));
imageNew.ReleaseDC();
when i gave this rect portion ..the saving images contains ..full black
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
rajugis wrote: when i gave this rect portion ..the saving images contains ..full black
I think this problem could occur when your original image is indexed. You can read about indexed colors here[^].
If we want to copy indexed images we have to copy their color tables too. We can easily do this with CImage class.
First we have to check if the image is indexed and if it is than copy its color table, just like that:
if(imageOriginal.IsIndexed())
{
const int nMaxColors = imageOriginal.GetMaxColorTableEntries();
RGBQUAD* pColorTable = new RGBQUAD[nMaxColors];
imageOriginal.GetColorTable(0, nMaxColors, pColorTable);
imageNew.SetColorTable(0, nMaxColors, pColorTable);
delete [] pColorTable;
}
This code must be inserted after the creation of the new image. I've made a test application and it works fine for me for both indexed and on-indexed TIFFs. Here is the complete method:
void CTestCImageAppDlg::OnBnClickedButtonTest()
{
CImage imageOriginal;
HRESULT hrLoad = imageOriginal.Load(_T("D:\\testImg1.tif"));
if(FAILED(hrLoad))
{
CString msg;
msg.Format(_T("Error on load. Code:%08x"), hrLoad);
AfxMessageBox(msg);
return;
}
CRect rectCopy(0, 0, imageOriginal.GetWidth() / 2, imageOriginal.GetHeight() / 2);
CImage imageNew;
imageNew.Create(rectCopy.Width(), rectCopy.Height(), imageOriginal.GetBPP());
if(imageOriginal.IsIndexed())
{
const int nMaxColors = imageOriginal.GetMaxColorTableEntries();
RGBQUAD* pColorTable = new RGBQUAD[nMaxColors];
imageOriginal.GetColorTable(0, nMaxColors, pColorTable);
imageNew.SetColorTable(0, nMaxColors, pColorTable);
delete [] pColorTable;
}
CRect rect(rectCopy);
rect.OffsetRect(-rectCopy.left, -rectCopy.top);
imageOriginal.BitBlt(imageNew.GetDC(), rect, rectCopy.TopLeft());
imageNew.ReleaseDC();
HRESULT hrSave = imageNew.Save(_T("D:\\testImg2.tif"), Gdiplus::ImageFormatTIFF);
if(FAILED(hrSave))
{
CString msg;
msg.Format(_T("Error on save. Code:%08x"),hrSave);
AfxMessageBox(msg);
return;
}
}
I hope this helps you.
Regards
Nuri Ismail
modified on Thursday, September 17, 2009 4:12 AM
|
|
|
|
|
wow ..its great ...
thanks for your help ...............
really thanks Nuri !!!!!!11
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
You are welcome!
|
|
|
|
|
Could someone give me a hint on how I could show one view full screen on a second monitor while the app with all the navigation pane, toolbars, menus, etc. stays on the main monitor?
Ideally, this would just be a second view opened for the current document that can escape the apps frame and go over to the other monitor and make itself full screen.
I've considered just using a second app with sockets for communications between the two apps.
I've considered using a secondary GUI thread with a CWnd derived object that is sort of operating outside of MFC's doc/view architecture.
|
|
|
|
|
It's quite a good question! I think there's an article in it somewhere!
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hi all,
I have build a MFC single document app, which is not show in full screen at run time. Now in which class will i change the code and what code (Frame, or in App) for show it full screen when i click at run button.
Thanks to all
Shaheen
|
|
|
|
|
Have you looked at the call to ShowWindow() in the app's InitInstance() method?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|