|
I found a <http: www.codeproject.com="" script="" comments="" forums.asp?forumid="1647&app=50&kw=colors&select=98566#xx98566xx"" target="_new">thread from a few days ago about getting a CListCtrl to draw more than 16 colours from its associated CImageList.
CBitmap bitmap;
bitmap.LoadBitmap(IDB_CERT_PG);
m_pImageList = new CImageList;
m_pImageList->Create(16,16, ILC_COLORDDB | ILC_MASK, 2,2);
m_pImageList->Add(&bitmap, RGB(0,0,0));
m_pImageList->Add(&bitmap, RGB(0,0,0));
m_listctrl.SetImageList(m_pImageList, LVSIL_SMALL);
The CListCtrl draws the bitmaps in 16 colours. I have tried setting up a halftone palette, but that didn't work either. Am I going to have to override CImageList's OnDraw() to draw the bitmap myself in over 16 colours?
Simon
Nobody does chicken like MFC
Sonork ID 100.10024
|
|
|
|
|
|
That's the problem - ILC_COLOR24 doesn't work. CListView still insists on 16 colours.
Simon
Nobody does chicken like MFC
Sonork ID 100.10024
|
|
|
|
|
Hi!
I've tried to get my app to do what Start->Run does, but failed. The string entered in the Start->Run editbox must be passed to some function in a dll somewhere. Does anyone know which?
ShellExecute(), CreateProcess() and system() won't do.
|
|
|
|
|
The "Start->Run" doing nothing but simple ShellExecute() . What you mean that it isn't working? So or you passed wrong parameters to it or the path doesn't exists.
Post an example of what are you doing with ShellExecute()
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
hWnd is a common editbox
int commandLength = ::GetWindowTextLength(hWnd);
LPTSTR szCommand = new TCHAR[commandLength + 1];
::GetWindowText(hWnd, szCommand, commandLength + 1);
LPTSTR szParameters = strchr(szCommand, ' ');
if (szParameters)
{
szParameters[0] = '\0';
szParameters++;
}
::ShellExecute(NULL, NULL, szCommand, szParameters, NULL, SW_SHOWNORMAL);::SetWindowText(hWnd, TEXT(""));
delete[] szCommand;
The command is run, but if I type an errouneous command, no errormessages are displayed. I would like ShellExecute to do that for me. I've tried several different parent-window handles as parameter, but no messagebox are displayed.
|
|
|
|
|
ShellExecute doesn't do the messagebox for you.
You need to check the return value and then display a messagebox by yourself
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thank god it doesn't no less!!! Would sort of make headless applications hard to write.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I have "simple object",when I created it I accepted all default attribute.
Now I want to add Method with "callback" attribute,but after compile it return error:
method definition--->[id(4), helpstring("method KeyboardProc"), callback] HRESULT KeyboardProc(int nCode,WPARAM wParam,LPARAM lParam);
error---->error MIDL2304 : attribute invalid on a proc in an [object] interface : : [callback] [ Procedure ...
I also test this and get this error:
method definition--->[callback(4), helpstring("method KeyboardProc")] HRESULT KeyboardProc(int nCode,WPARAM wParam,LPARAM lParam);
error---->error MIDL2025 : syntax error : expecting ] or , near "("
***I also want the return vale to be "LRESULT" but I can not change "HRESULT" when I want to add Method.*****
|
|
|
|
|
I'm not quiet sure what you are trying to achieve here.
COM IDL is limited to certain data types and callback certainly isn't one of them. COM methods can only return HRESULTS, if you want to return a value it needs to be passed back as a pointer via the parameter list.
Michael
|
|
|
|
|
If you look up error 2304, it reads;
MIDL2304: attribute invalid on a procedure in an [object] interface
The specified attribute is not allowed on procedure in a COM interface.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I want my method return Keyboard messages?(It hook keyboard message)
What attribute my method should have and what it should return?
|
|
|
|
|
Hi, I was wondering if anyone out there knew of a place where I might either buy or obtain (open-source) a copy of an "intellisense" control, similar to that of Visual Studio? I am in the process of working on an editor and such a control would be awesome.
|
|
|
|
|
Didn't understand your post at all, lmao. But according to Subject, I see you want an Autocompletion.... The only thing.... Not ListBox, but ComboBox..
Well, look in MSDN for interface IAutoComplete
Hope this is what you want
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Hi, thanks for replying, however, I was trying to ask whether a "popup intellisense menu" existed as separate control. You know how in MSVC, after you type a "." or a "->", all the class members of the object you are dealing with will be displayed? I would like to incorporate "intellisense" into my very own, homegrown editor.
|
|
|
|
|
Try this:
http://www.ticz.com/homes/users/nlewis/index.html?target=intro
LEt me know if you have any questions on usage.
|
|
|
|
|
Dude. This is EXACTLY what I was looking for! Thanks a million.
|
|
|
|
|
What's wrong with the following?
#include <vector>
class kConfig
{
protected:
public:
typedef int (*cheese)(void*);
struct kconfig_handler{
char* settingName,
cheese handlerFunc,
void* pObject;
};
kConfig();
~kConfig();
void registerHandlers(kconfig_handler[] handlers);
int loadConfig(char* pchFilename);
private:
std::vector< kconfig_handler* > m_settingList;
};
I keep getting this error when i try to compile:
f:\software\katie\include\kconfig.h(24) : error C2146: syntax error : missing ';' before identifier 'handlerFunc'
That error refers to the line
cheese handlerFunc,
Stephen Caldwell
Blackfission, CEO
http://blackfission.myip.org:81
|
|
|
|
|
struct kconfig_handler {
char* settingName,
cheese handlerFunc,
void* pObject;
}; You have commas there instead of semicolons.
--Mike--
My really out-of-date homepage
"Hey, you wanna go to the Espresso Pump and get sugared up on mochas?"
-- Willow Rosenberg
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
No wonder, and to think I make structs all the time. How could that have happened? I guess age has caught up with me (17 years).
Stephen Caldwell
Blackfission, CEO
|
|
|
|
|
Heh, I type , instead of ; in for loops all the time and it bugs the heck out of me.
--Mike--
My really out-of-date homepage
"Hey, you wanna go to the Espresso Pump and get sugared up on mochas?"
-- Willow Rosenberg
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
When I help my team mate with VB occasionally I have trouble when I press ENTER because I can't help terminating the statements with a ';' and the VB auto syntax checker pops up the error dialog
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
How can I write my own stream?
I need to write a stream class and redirect cerr to it. Based on the class settings I will log it to a file or a database.
I need to use the class like below
#include <iostream>
#include <fstream>
int main()
{
std::ofstream logFile("out.txt");
std::streambuf *outbuf = std::cout.rdbuf(logFile.rdbuf());
std::streambuf *errbuf = std::cerr.rdbuf(logFile.rdbuf());
// do the actual work of the program;
// GUI code and event loop would go here
std::cout << "This would normally go to cout but goes to the log file\n";
std::cerr << "This would normally go to cerr but goes to the log file \n";
logFile << "This goes to the log file\n";
// end of program body
// restore the buffers
std::cout.rdbuf(outbuf);
std::cerr.rdbuf(errbuf);
}
But my class will log to the disk or log to a DBMS.
Regards,
Xavier
|
|
|
|
|
Here's one I wrote that uses WM_COPYDATA to send a line when it finds a \r
template <class chart,="" class="" traits="">
class DebugStr : public std::basic_streambuf<chart, traits="">
{
public:
DebugStr()
{
m_ParenthWnd = m_DebughWnd = NULL;
};
HWND m_ParenthWnd, m_DebughWnd;
protected:
std::string m_string;
int_type overflow(int_type c = traits_type::eof())
{
if (c != traits_type::eof())
{
if ('\n' == c)
{
// We check to make sure we have the HWND and it's still valid.
if (m_DebughWnd && ::IsWindow(m_DebughWnd))
{
COPYDATASTRUCT cds;
cds.cbData = m_string.size();
cds.lpData = (void*)(LPCSTR)m_string.c_str();
::SendMessage(m_DebughWnd, WM_COPYDATA, (WPARAM)m_ParenthWnd, (LPARAM)&cds);
}
m_string = "";
}
else
{
m_string += traits_type::to_char_type(c);
// If we have the parent window, but not the debug window, or it's become invalid,
// we call Init again and attempt tp find it.
if (m_ParenthWnd && (!m_DebughWnd || !::IsWindow(m_DebughWnd)))
{
SDebug::Init(m_ParenthWnd);
}
}
return c;
}
return traits_type::not_eof(c);
};
};
Through the details of my implimentation you should find a skeleton there you can use to create a stream.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I wanna play multiple AVIs,but a interval of silence occured when file1 finished and file2 is rendering.How can i avoid that ?
Any Pointer or hint will be appreciated !
Thanks a lot!!
|
|
|
|