|
Dr. Newcomer is a SME on device drivers. See his book here.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi guys,
I have a problem.
I would like to make the system menu the menu of my notify icon. The menu comes up but doesn't work. I am doing so that the user can work with the application even if it is hidden and I don't want to create another menu.;)
Is it possible to do this.
Thanks
Nibu thomas
|
|
|
|
|
Nibu thomas wrote: so that the user can work with the application even if it is hidden and I don't want to create another menu
AFAIK, you have manually route them using your custom Window Message Handller which you have mentioned while creating the System Tray Icon i.e. NOTIFYICONDATA.uCallbackMessage
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Yeah that is fine.
It is working like that.
But I wanted the system menu to be displayed as the tray icon menu. The menu is coming but not working. So I wanted to whether there is another way of going about this apart from using another menu.
Nibu thomas.
Software Developer.
|
|
|
|
|
I use Windows XP.
I created a new desktop named desktop2, switched to it using SwitchDesktop API and created a explorer process there using CreateProcess API.
Everything is fine, but the windows shortcut key is not working in the new desktop. If I use Win+E to get the explorer, explorer opens in the default desktop, not in the new one.
What can I do to get rid of this problem?
Thank you.
- NS -
|
|
|
|
|
I have a class that takes this list of name value pairs:
<mydocs> - C:\docs and sets\user\my documents
<home> - C:\docs and sets\user
and then there is a function, that substitutes these variables in "<home>\\local settings".
but I dont know what to name this class. any suggestions?
thanks!
|
|
|
|
|
-----> hr = db.Open(_T("SQLOLEDB.1"), dbinit);
if (FAILED(hr))
{AfxMessageBox("Failed To Connect Datasource"); }
My code is terminating on above line please help.
Actually senior programmer who developed code left for me to debug
help.
Detailed code is below
void OleList::ExecuteQuery(CString str,bool refreshcol,bool fillcheckbox)
{
ptr=new CObArray;
USES_CONVERSION;
CDataSource db;
-----> HRESULT hr = db.Open(_T("SQLOLEDB.1"), dbinit);
if (FAILED(hr))
{
AfxMessageBox("Failed To Connect Datasource");
return;
}
CSession session;
session.Open(db);
int i=0;
CCommand product;
CString temp=GenerateSQL();
LONG row;
char tt[50];
hr=product.Open(session,temp, NULL, &row, DBGUID_DEFAULT, true);
if (FAILED(hr))
{
AfxMessageBox("Failed To Create Table");
return;
}
if(refreshcol)
{
// coltype.RemoveAll();
DBTYPE pType;//=NULL;
for(ULONG j=0;j< product.GetColumnCount() && j < colsize;j++)
if(product.GetColumnType(j+1,&pType))
coltype->SetAt(j,pType);
}
i=0;
if(product.MoveFirst()==S_OK)
do{
CStringArray* sarr=new CStringArray;
sarr->SetSize(colsize);
for(int k=1;k<=colsize;k++)
{
CString st;
switch(coltype->GetAt(k-1))
{
case DBTYPE_STR :
{
char* tm=(char*)product.GetValue(k);
st=A2T(tm);break;
}
case DBTYPE_DBTIMESTAMP : st=GetTime(product.GetValue(k)); break;
case DBTYPE_BOOL : GetBool(product.GetValue(k),&st); break;
case DBTYPE_R4 : GetFloat(product.GetValue(k),&st); break;
case DBTYPE_R8 : GetDouble(product.GetValue(k),&st); break;
case DBTYPE_I4 : GetLong(product.GetValue(k),&st); break;
case DBTYPE_I2 : GetSort(product.GetValue(k),&st); break;
case DBTYPE_UI1 : GetUInt(product.GetValue(k),&st); break;
}
/*if(k==1)
InsertItem(i,st);
else
SetItemText(i,k-1,st);*/
st.TrimRight();
sarr->SetAt(k-1,st);
}
ptr->Add(sarr);
i++;
product.FreeRecordMemory();
}while(product.MoveNext()==S_OK);
if(checkarr!=NULL)
checkarr->RemoveAll();
checkarr=new CWordArray;
checkarr->SetSize(i);
for(int m=0;m checkarr->SetAt(m,fillcheckbox+1);
SetItemCountEx(i);
//char tt[50];
//AfxMessageBox(itoa(i,tt,10));
// SetItemCount(i);
Invalidate();
m_HeaderCtrl.listsize=i;
m_HeaderCtrl.checkarr=checkarr;
product.Close();
session.Close();
db.Close();
m_HeaderCtrl.ptr=ptr;
SetCursor(hcurSave);
}
My code is terminating on above line please help.
Actually senior programmer who developed code left for me to debug
help.
|| ART OF LIVING ||
-- modified at 23:11 Sunday 6th November, 2005
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/vcrefcdatasourceopen.asp[^]
shivditya wrote: HRESULT hr = db.Open(_T("SQLOLEDB.1"), dbinit);
SQLOLEDB.1 is plainly not a Prog ID for a data source you have available to you on this machine, or it has a password that you've not provided. I have SQL Server installed, and SQLOLEDB.1 does not exist in my registry ( I didn't expect it to ). Where did this code come from ? Did it ever work ? I reckon it's been copied and pasted from the web. If this is what your senior programmer does ( copy/paste/give it to someone to make it work ), I'd be looking for a job.
shivditya wrote: Actually senior programmer who developed code left for me to debug
It looks like a mess to me, this is written by the senior programmer you say ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Truely speaking this entire function in his code working very properly when i am trying to implement it is refusing to connect.
In our firm there is only one database.One thing is sure he has used some OleDB concept ,second thing you can find word SQLOLEDB
In msdn
|| ART OF LIVING ||
-- modified at 1:40 Monday 7th November, 2005
|
|
|
|
|
shivditya wrote: In our firm there is only one database.
That's lovely. Obviously, his computer is configured to use it and yours is not. So why don't you ask him ?
shivditya wrote: second thing you can find word SQLOLEDB
In msdn
I'm sure you can, but if it relates to a prog ID that gets set up by SQL Server automatically, it would be set up on my computer. MSDN said to pass in a prog ID, which would be in the registry if it was set up.
Instead of asking the same question over and over, and not following up on the advice people give you, go and ask the guy who wrote the code, because it's obvious the issue is one of setting up the database connection on your machine.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Why don't you try to open the database connection in a database gui tool, and see what happens?
You might get interesting information about the problem that way.
Just a thought...
|
|
|
|
|
See here.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I am trying to work with icons in the system tray and on the title bar and the resource editor from the 6.0 suite. I can only create bitmaps or icons with 256 colors. Is there any way that I could create an SVG file or PNG/JPG and use those for the icons?
|
|
|
|
|
Now, I have VS .NET 2002 so I'm not sure this works for you. I recently started working with CTreeCtrl's and I needed two custom icons. I created them in MS Paint, saved as 16x16 24-bit bitmaps. I imported them into my project via the resource view, they showed up under the category "Bitmaps", one called IDB_FILE and another called IDB_FOLDER. For the CTreeCtrl, to use icons, I have to load up a CImageList data type with my images, then attach it to the CTreeCtrl. This is the resulting code in regards to the CImageList, I don't know how helpful it was but it did the job fine for me:
m_images.Create(16, 16, ILC_COLOR24 | ILC_MASK, 0, 2);<br />
<br />
CBitmap folder;<br />
ASSERT(folder.LoadBitmap(IDB_FOLDER));<br />
ASSERT(m_images.Add(&folder, RGB(0, 255, 128)) != -1);<br />
<br />
CBitmap file;<br />
ASSERT(file.LoadBitmap(IDB_FILE));<br />
ASSERT(m_images.Add(&file, RGB(0, 255, 128)) != -1);<br />
<br />
m_tree.SetImageList(&m_images, TVSIL_NORMAL);
Note, m_images is the CImageList and m_tree is the CTreeCtrl.
I also implemented a mask so the background of the control can be changed and the icons' picture will change appropriately. I painted the RGB color 0, 255, 128 on the image where I want transparency then on the Add() command, I specify what color the mask color is. Again, I don't know how helpful this is to your project but good luck.
|
|
|
|
|
Thank you for the response. Unfortunately though, when I import anything more than 256 colors, it gets converted to 256 colors. Please note that I believe this is a limitation of Visual C++ 6.0 and its resource editor. I am assuming that I will have to load the icon from code somehow and just link everything externally via files. I could be wrong, but this is why I am here
|
|
|
|
|
haputanlas wrote: I am trying to work with icons in the system tray and on the title bar and the resource editor from the 6.0 suite. I can only create bitmaps or icons with 256 colors. Is there any way that I could create an SVG file or PNG/JPG and use those for the icons?
AFAIK, you couldn't be able to use HIGH res Icon in Visual C++ 6.0
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
You can't use hi-res images from within VC6. You need to create them using another application and then modify the RC file manually.
The two most common elements in the universe are Hydrogen and stupidity. - Harlan Ellison
Awasu 2.1.3 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Hi I’ve been trying to write a routine that will scan 1 bitmap to see if a second bitmap is within it. I’m not having a problem with the algorithm to do the search I’m having problems getting the pixel colors from both the bitmaps. For testing I loaded the first image by calling ::LoadImage() which returns an HBITMAP. For the second image I’m loading into I.E. and using some code to get the hwnd and pull the HBITMAP calling CopyWindowToBitmap().
So now that I have 2 variables of type HBITMAP. How do I get there pixels?
This is what I’ve tried with no success.
HBITMAP bmpOne;
HBITMAP bmpTwo;
… Some code to get bmpOne and bmpTwo ..
HDC hDC = ::GetDC(NULL);
HDC hDCBMPOne = ::CreateCompatibleDC(hDC);
HDC hDCBMPTwo = ::CreateCompatibleDC(hDC);
::SelectObject(hDCBMP1 , bmpOne);
::SelectObject(hDCBMP2 , bmpTwo);
COLORREF PixelOne;
COLORREF dPixelTwo;
PixelOne = ::GetPixel(hDCBMPOne, x, y);
PixelTwo = ::GetPixel(hDCBMPTwo, x, y);
If I do the following…
int red = GetRValue(PixelOne);
int green = GetGValue(PixelOne);
int blue = GetBValue(PixelOne);
Even though the color at x,y is not white I always get
red = 255, green= 255 and blue = 255;
I know that the HBITMAP bmpOne and bmpTwo are loaded because I display them in a dialog.
Any thoughts? Is there a way to get the pixel data directly from HBITMAP? Thanks.
|
|
|
|
|
I think you can do this by select the bitmap(s) into a device context (one at a time) and then calling GetPixel() [^].
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
GetPixel is terribly slow, can you create a HBITMAP so that it's also a DIBSECTION ? Then you'll have a pointer to the underlying bytes for this sort of work.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I second that. GetPixel() is horribly slow! The only downside with dibsections is that you'd have to take bitdepths into consideration. A small price to pay for good performance though.
--
Pictures[^] from my Japan trip.
|
|
|
|
|
I have a class called CFileObject derived from CObject and a class called CFileTree derived from CObList. At a particular point in my program, I have an if statement that tests if an object (could be a CFileObject or CFileTree) is a CFileObject. At a point in the execution, the object is a CFileTree but when it runs the test, it returns true, saying it's a CFileObject which is incorrect. Do I need to declare my two types as being the types that they are so IsKindOf() can resolve properly?
|
|
|
|
|
From the MSDN documentation[^]:
"This function works only for classes declared with the DECLARE_DYNAMIC , DECLARE_DYNCREATE , or DECLARE_SERIAL macro. Do not use this function extensively because it defeats the C++ polymorphism feature. Use virtual functions instead."
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
You could try using dynamic_cast instead. But as Ravi said, it's not good OO practice.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|