|
Like this:
GetDlgItem(IDC_BUTTON1)->EnableWindow(FALSE);
|
|
|
|
|
I'm gonna use "LoadKeyboardLayout()" function. As you know, one of it's parameters is "LPCTSTR pwszKLID", that's a Pointer to the buffer that specifies the name of the input locale identifier to load. But all I've got is a variable of type HKL that's set to a specified language identifier.
I wonder how can I get a string acording to that "language identifier"?
Thank you masters!
modified on Friday, November 7, 2008 7:14 AM
|
|
|
|
|
Possibly this will help [^].
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I wonder what could I we do without CPallini!
|
|
|
|
|
i have 1 menu n under that 2 menu item are there, whatever menu item i will select, for that menuitem a check mark should be displayed.for this i have done like:
pCmdUI->SetCheck(TRUE); for both menu items.
but it is not working.
thanks in advance
best regards,
anjali
|
|
|
|
|
Add the handler for WM_INITMENUPOPUP in your dialog class and copy the following code in that function.
CWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
ASSERT(pPopupMenu != NULL);
CCmdUI state;
state.m_pMenu = pPopupMenu;
ASSERT(state.m_pOther == NULL);
ASSERT(state.m_pParentMenu == NULL);
HMENU hParentMenu;
if(AfxGetThreadState()->m_hTrackingMenu == pPopupMenu->m_hMenu)
state.m_pParentMenu = pPopupMenu;
else if((hParentMenu = ::GetMenu(m_hWnd)) != NULL)
{
CWnd* pParent = this;
if(pParent != NULL && (hParentMenu = ::GetMenu(pParent->m_hWnd)) != NULL)
{
int nIndexMax = ::GetMenuItemCount(hParentMenu);
for (int nIndex = 0; nIndex < nIndexMax; nIndex++)
{
if(::GetSubMenu(hParentMenu, nIndex) == pPopupMenu->m_hMenu)
{
state.m_pParentMenu = CMenu::FromHandle(hParentMenu);
break;
}
}
}
}
state.m_nIndexMax = pPopupMenu->GetMenuItemCount();
for(state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax; state.m_nIndex++)
{
state.m_nID = pPopupMenu->GetMenuItemID(state.m_nIndex);
if(state.m_nID == 0)
continue;
ASSERT(state.m_pOther == NULL);
ASSERT(state.m_pMenu != NULL);
if(state.m_nID == (UINT)-1)
{
state.m_pSubMenu = pPopupMenu->GetSubMenu(state.m_nIndex);
if(state.m_pSubMenu == NULL ||
(state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
state.m_nID == (UINT)-1)
{
continue;
}
state.DoUpdate(this, TRUE);
}
else
{
state.m_pSubMenu = NULL;
state.DoUpdate(this, FALSE);
}
UINT nCount = pPopupMenu->GetMenuItemCount();
if(nCount < state.m_nIndexMax)
{
state.m_nIndex -= (state.m_nIndexMax - nCount);
while(state.m_nIndex < nCount &&
pPopupMenu->GetMenuItemID(state.m_nIndex) == state.m_nID)
{
state.m_nIndex++;
}
}
state.m_nIndexMax = nCount;
}
-Saurabh
|
|
|
|
|
Command enablers don't get called for dialogs by default.
You can enable them by adding a handler for the undocumented
WM_KICKIDLE message, something like this:
ON_MESSAGE(WM_KICKIDLE,&CMyDlg::OnKickIdle)
...
LRESULT CMyDlg::OnKickIdle(WPARAM wp, LPARAM lp)
{
UpdateDialogControls(this, TRUE);
return 0;
}
WM_KICKIDLE for Updating MFC Dialog Controls[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
In general, (not just what you said here) using the undocumented functions, is ideal?
Could you please share your opinion regarding this?
|
|
|
|
|
I personally don't use undocumented system messages or functions.
In this case, it's part of MFC, which we all have the source code for.
WM_KICKIDLE has been around a long time and it's pretty unlikely it will
go away. Maybe they'll even document it some day
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank you for your reply
|
|
|
|
|
Hallo
I want to create a new view or a popup window against a button click and want to draw somthing at new window.
Thanks
Munna
|
|
|
|
|
When I compiled the following very simple "c" code in Release mode, VC++ 6.0 compiler is giving the INTERNAL COMPILER ERROR error. Can anybody tell me why this happens.
/*test.c*/
void main()
{
__int64 a=0, b=0;
do
{
int c = a-b ? a-b : 0;
b = c;
}while(b);
}
Thanks
Shino
|
|
|
|
|
Do you get any different result if you change the file's extension to CPP?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
No problem. But still compiler is showing the same error.
|
|
|
|
|
What compiler are you using? Other than a C4244 warning, I compiled it just fine with VS6. Have you read this?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Do you have the latest visual C++ 6.0 service pack installed? The latest one is Service pack 6 . You could find it here[^].
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
i need convert image bitmap 8bits to image bitmap 24bits or convert image bitmap 8bits to file pcl. thanks very much
|
|
|
|
|
To convert from 8-bits to 24-bits simple copy the value from 8-bit image to all 3 channels in the 24-bits image.
-Saurabh
|
|
|
|
|
Saurabh.Garg wrote: copy the value from 8-bit image to all 3 channels in the 24-bits image.
Are you sure?
|
|
|
|
|
Yes, why? Would you do it any other way?
-Saurabh
|
|
|
|
|
8 bitimages are normally having a color palette where the actual color is stored. And the index to that color array is stored as pixel info (that is the 8bit).
|
|
|
|
|
don't know. can you tell specific ?
|
|
|
|
|
can you tell technical raster when process image bitmap 8bits ?
|
|
|
|
|
In general, for 8 bit images there will be a color palette. And each pixel is stored as 8 bit data. But it will not be the actual color. Instead it will be an index of the color palette. Since one pixel is stored with 8 bit data, there can be a maximum of 256 colors. The color palette is having the RGB info of these 256 colors.
Hope it is clear to you.
I am not sure about typical monochrome images.
Like the 8 bit image there are 4 bit images also. In that the pixel is stored with 4 bit pixel info and it is the index of the color palette of maximum of 16 colors.
|
|
|
|
|
you convert DrawImage_24Bits() to DrawImage_8Bits() for help me ?. wish your help. thanks very much
void DrawImage_24Bits()
{
string cmd = "";
int i = 0, j = 0;
long x= 0, y =0, nbytes = 0, pos = 0, nbyteR =0;
x = m_biWidth*3;// * 2.875;
y = m_biHeight*3;// * 2.875;
nbyteR = (((m_biWidth * m_biBitCount + 31) & ~31) >> 3);
nbytes = (((x * m_biBitCount + 31) & ~31) >> 3);
y = abs(y);
cmd += STAR; cmd += lib;
m_objPrint->PrintPclCommand(cmd.c_str(), UIM, 0);
int zerobit= nbytes - x;
buf = new char[nbyteR * m_biHeight];
int num_read = fread((void*)buf, sizeof(char), (nbyteR * m_biHeight), f_bmp);
m_sizeimage = nbytes * y;
ResizeBuffImage(buf, num_read, x);
pos = m_sizeimage - nbytes;
int Byte = 0;
for (j = 0; j < y; j++)
{
Byte = 0;
m_objPrint->PrintPclCommand(cmd.c_str(), UIW, nbytes);
for ( i = 0; i < x; i++)
{
m_objPrint->Print(bufR[pos + Byte++]);
m_objPrint->Print(bufR[pos + Byte++]);
m_objPrint->Print(bufR[pos + Byte++]);
}
if(zerobit >0)
for(int tt = 0; tt < zerobit ; tt++)
m_objPrint->Print(0);
pos -= nbytes;
}
}
void ResizeBuffImage(const char *buff, long size, long width)
{
long nbyteR = (((m_biWidth * m_biBitCount + 31) & ~31) >> 3);
long count = 0, w = width, j = 0, tempw = 0;
int redubit= size - m_biWidth * m_biHeight;
if (redubit > 0 && redubit % m_biWidth == 0)
redubit /= m_biWidth ;
bufR = new char[m_sizeimage]; //size * 9
for (long i = 0; i < size; i+=3)
//for (long i = 0; i < size; i++)
{
bufR[count++] = buff[i];
bufR[count++] = buff[i+ 1];
bufR[count++] = buff[i+ 2];
bufR[count++] = buff[i];
bufR[count++] = buff[i+ 1];
bufR[count++] = buff[i+ 2];
bufR[count++] = buff[i];
bufR[count++] = buff[i+ 1];
bufR[count++] = buff[i+ 2];
if ((count + redubit) % (w + redubit) == 0)
{
for (int m = 0; m< redubit; m++)
{
bufR[count++] = buff[i+3+m];
i++;
}
//copy width image to three times
//for (int times = 0; times < 2; times++)
for (int times = 0; times < 2; times++)
{
tempw = count;
for ( j = count - (w + redubit) ; j < tempw ; j++ )
{
bufR[count++] = bufR[j];
}
}
}
}
}
}
|
|
|
|