|
I would like to paint a focus rect around the inside of my buttons, I can not figure out how to make a brush that is the text color every other pixel (like the standard windows buttons focus rect)
wWw.KruncherInc.cOm
|
|
|
|
|
Take a look at CPen you can set its style to PS_DOT
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Oh, I'm sorry, I forgot to mention that this program is all WIN32 not MFC.
wWw.KruncherInc.cOm
|
|
|
|
|
You'll need to call SetROP2() with the appropriate draw mode type then select a null brush into the DC so that Rectangle() will only draw the border of the rectangle without filling it.
You could take a look at one of the custom button drawing articles to see how it is done. Yes I know they are using MFC, but the steps are exactly the same. Since MFC DC class is just a wrapper around the Win32 function calls with some additional functionality to help avoid a few steps, you should have no problem understanding what they are doing.
Good Luck!
INTP
|
|
|
|
|
Hi!
I want a context menu when I click over my icon so I've done:
...
NOTIFYICONDATA icon;
icon.cbSize = sizeof(NOTIFYICONDATA);
icon.hWnd = hWnd;
icon.uID = Id;
icon.uFlags = NIF_MESSAGE|NIF_ICON;
icon.uCallbackMessage = WM_ICON_NOTIFY;
icon.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP;
icon.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(Id));
Shell_NotifyIcon(NIM_ADD, &icon);
...
(WndProc)
case WM_ICON_NOTIFY:
hMenu = LoadMenu(hInst,(LPCTSTR)IDR_MENU1);
if (lParam == WM_RBUTTONDOWN)
{
GetCursorPos(&pos);
if (!SetForegroundWindow(hWnd)) return 0;
TrackPopupMenu (hMenu, TPM_NONOTIFY | TPM_RETURNCMD | TPM_LEFTBUTTON,
pos.x, pos.y, 0, hWnd, NULL);
PostMessage(hWnd, WM_NULL, 0, 0);
}
break;
I suppose i'm doing it not too well because it doesn't works.
Can anyone help me? Thanks.
|
|
|
|
|
Nobody can help me?
Thanks!
|
|
|
|
|
lillah wrote:
WM_ICON_NOTIFY
i want to know the value of WM_ICON_NOTIFY,is you put it in range of WM_USER message or not.
i have to used NotifyICondata in one of my article AT CP named ShutDown Alaram.
anyway if you don't want to search code form that here is code.Sorry but it in MFC
<br />
ON_MESSAGE(WM_USER+75,OnSystemBarMessage)<br />
m_niData.cbSize=sizeof(NOTIFYICONDATA);<br />
m_niData.hIcon=m_Icon;<br />
m_niData.hWnd=this->m_hWnd;<br />
sprintf(m_niData.szTip,"Shut Down Alarm :My Father Software inc @ 2003");<br />
m_niData.uCallbackMessage=WM_USER+75;<br />
m_niData.uFlags=NIF_ICON|NIF_MESSAGE|NIF_TIP;<br />
m_niData.uID=ID_ICONDATA;<br />
Shell_NotifyIcon(NIM_ADD,&m_niData);<br />
<br />
<br />
void DlgShutDown::OnSystemBarMessage(WPARAM wParam, LPARAM lParam)<br />
{<br />
<br />
switch(lParam)<br />
{<br />
case WM_LBUTTONDOWN:this->ShowWindow(SW_RESTORE);this->ShowWindow(SW_SHOW);bMiniShow=FALSE; break;<br />
case WM_RBUTTONDOWN:<br />
{<br />
CMenu mnu;<br />
mnu.LoadMenu(IDR_MENU1);<br />
<br />
PopUpMenu=mnu.GetSubMenu(0);<br />
<br />
SetForegroundWindow();<br />
CPoint pt;<br />
GetCursorPos(&pt);<br />
<br />
PopUpMenu->TrackPopupMenu(TPM_RIGHTALIGN,pt.x,pt.y,this);<br />
<br />
<br />
break;<br />
<br />
}<br />
}<br />
<br />
<br />
}<br />
<br />
<br />
Hope you can work it out
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi!
I define WM_ICON_NOTIFY as WM_USER+2
Basically, I do the same as you but for Win32, so I define this funtion
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
and process the message WM_ICON_NOTIFY but......I don't know why it doesn't works
I'm doing the same steps you do and the same that other do in their articles
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
HMENU hMenu, subMenu;
POINT pos;
BOOL traymsj;
hMenu = LoadMenu(hInst,(LPCTSTR)IDR_MENU1);
if (!hMenu) return 0;
switch (message)
{
case WM_ICON_NOTIFY:
if (wParam != (IDI_ICON1|IDI_ICON2)) return 0;
if (lParam == WM_RBUTTONDOWN)
{
subMenu = GetSubMenu(hMenu,0);
GetCursorPos(&pos);
if (!SetForegroundWindow(hWnd)) return 0;
TrackPopupMenu (subMenu, TPM_NONOTIFY | TPM_RETURNCMD | TPM_LEFTBUTTON, pos.x, pos.y, 0, hWnd, NULL);
PostMessage(hWnd, WM_NULL, 0, 0);
}
break;
...
|
|
|
|
|
I'm trying to draw a line on a form through a function which is in a class that I created inside another .h and .cpp file. But I cannot give it access to the main form or it's controls. Is there any way that I can pass the form into the functions of the class or a way that I can access the main form or maybe just a picturebox on the form in which I can draw too. And if so, how can I declare a temporary form / picturebox inside the class which I can then assign to the form / picturebox of the main form to?
PJ
|
|
|
|
|
you should be able to just pass the CDC device context to the external class for direct manipulation.
A bit like how the painting of a control is handled. The drawing area can be directly handled by the view, or its device context (CDC) can be passed to an external class for its own drawing mechanism.
I Dream of Absolute Zero
|
|
|
|
|
I need to use function of Math Class such as Sin(),ASin()
but i can't plase tell the way ,thank you
|
|
|
|
|
"#include <math.h>"
will let you use most common math functions. sin, cos and stuff like that.
|
|
|
|
|
What Math class?
Which language are you working on??
In C/C++, you can #include "math.h" and use functions like sin(...), cos(...), asin(...), log(...) etc.
ARSALAN MALIK
|
|
|
|
|
tell me what the problem in c++ i see your problem i mean what the problem in maths class plz write and send me my address is talharehman@dr.com ok
|
|
|
|
|
... toMatrix(int row,int colum,CString matrix)
{
Cstring m[row][colum];//Why this line erroe?????
return ...;//
}
I need return m to other function,plase tell the way.
thank you.
|
|
|
|
|
you need to have a fixed size at compile time.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Try something like this...
// ***************************************
// Example: Dynamic Multidimensional Array
// ***************************************
// We want both array dimensions to be allocated dynamically and
// to be able to reference an element as x[i][j]
// Here's how to do it...
// ***********
// MFC Version
// ***********
// Array of ints
typedef CArray <int, int=""> CIntArray;
// Array of arrays of ints
typedef CArray <cintarray, cintarray&=""> CMultiIntArray;
void TraceDynamicArray(const unsigned int rows, const unsigned int columns)
{
CMultiIntArray aTest;
// Allocate number of rows
aTest.SetSize( rows );
// For each row
for (int row = 0; row < aTest.GetSize(); row++)
{
// Allocate number of columns
aTest[row].SetSize( columns );
// For each column
for (int column = 0; column < aTest[row].GetSize(); column++)
{
// Assign a value
aTest [row] [column] = 10 * row + column;
// Trace it
afxDump << aTest [row] [column] << "\t";
}
afxDump << "\n";
}
}
In your case you need to have
// Array of CString
typedef CArray <cstring, cstring=""> CStringArray;
// Array of arrays of CString
typedef CArray <cstringarray, cstringarray&=""> CMultiStringArray;
Kevin
|
|
|
|
|
Hello!
How can I retrieve the 'size on disk' of file (not the 'size' which is returned by the GetFileSize function)?
Thanks!
|
|
|
|
|
You'll first need to obtain the size of the disk's allocation unit. Divide the file's size by the allocation unit. Round the quotient up to the next whole number. Multiple that by the allocation unit. For example, if the size of the file is 124,356 bytes and the allocation unit is 2048 bytes:
124,356 / 2048 = 60.720703125 = 61 * 2048 = 124,928
This yields slack space of 572 bytes.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
How can I obtain disk's allocation unit in C++?
ARSALAN MALIK
|
|
|
|
|
GetDiskFreeSpace(strPath, &dwSectorsPerCluster, &dwBytesPerSector, &dwFreeClusters, &dwTotalClusters);
DWORD dwClusterSize = dwSectorsPerCluster * dwBytesPerSector; This will not work on volume sizes that are greater than 2GB. For that, I would use ZwQueryInformationFile(..., FileStandardInformation) .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
how can i countact to the server from program and copy the data from the server to the program
if any one can help me of this and send me the receurce
i will be thankfull for him/her
Best regards,
|
|
|
|
|
What server?, which technology?, what type of data?
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
I am working on a function that displays all related names when the user entering name. For now, I only can search the exact entried name! However, since the users always typing very fast and more often enter name with incorrectly (ie: Joh instead of John, Cater instead of Carter ...)
Is there any existed codes to correct for them?
Thanks for any help
|
|
|
|
|
A very easy and simple method that I have used is to use the Soundex algorithm to match words that may be spelt incorrectly, but is phonetically similar.
Have a search for this in Google and you will get a few good sites. Even SQL Server's T-SQL have a Soundex function!
I Dream of Absolute Zero
|
|
|
|