|
|
I trying to load an Icon from a file. ie c:\icon.ico. Which api function to use?
Thanks
|
|
|
|
|
LoadImage( NULL, _T("c:\\icon.ico"), IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
Dave
|
|
|
|
|
This is not a question or cry for help.
Rather, I wondered if anyone would be interested in some code that performs adaptive histogram equalization (AHE in imaging circles). If I see enough demand for it, I'll dust off some old code, wrap it up into a nice demo app and submit it as an article.
For those not familiar with the imaging field:
AHE is an algorithm to enhance the contrast of an image.
|
|
|
|
|
Here is some background info:
I code C++ for unix at my job. I have my directory shared via samba to my windows desktop. I have VS setup to use as my IDE.
Here is one question:
We save our files as *.cc instead of *.cpp and VS doesn't recognize this as a C++ file therefor I get no syntax highlighting and all that other cool stuff. Is there a way to add an extension (*.cc) to the list of C++ files?
Here is another question:
I added another folder to my project called libs where I put all of our classes. We have a class called Cstring and if I type Cstring:: it will pop up the box with all of member functions associated with that class. But if I do something like Cstring str; then type str. it does not pop up that nifty little box. Anyone know how to fix this? (Note: I am not actually compiling the files on my windows machine. Just saving them and then compiling on my unix term.)
Thanks in advance,
Jack
There are 10 types of people in this world, those that understand binary and those who don't.
|
|
|
|
|
I have encountered your
Cstring::/ Cstring str / str. problem with the autocomplete
as well. Sometimes I find it works for non-C++ native classes and sometimes it doesn't. I suspect that it is a bit flakey.
Unfortunately I cannot help you, but would appreciate anyone else's input who can shed some light on this...
|
|
|
|
|
An option to try is add the header file directly to the project. Don't count on the #include to parse the file for IntelliSense.
Phil Boyd
MCP
CPT, AR
You may be gone, but we will never forget your sacrifice.
"Proud to be an American..." Lee Greenwood
|
|
|
|
|
To force a file to be recognised as C++, use the /Tp option in your settings. Of course, you'll need to create a dummy project to have settings - put all your .cc files into it, and VC should be happy (it may even provide intellisense for you)
|
|
|
|
|
I have this in a static lib:
<br />
#ifdef _UNICODE<br />
typedef std::wstring _astr;<br />
#else<br />
typedef std::string _astr;<br />
#endif<br />
<br />
namespace SalieriFoundation<br />
{<br />
namespace Globals<br />
{<br />
void Func(const _astr &message)<br />
{<br />
...<br />
}<br />
}<br />
}<br />
Then I use it in a exe:
<br />
using namespace SalieriFoundation::Globals;<br />
<br />
Func(_T("the message"));<br />
So. I build ansi - fine. I build UNICODE and I get this:
<br />
<br />
Main.obj : error LNK2019: unresolved external symbol "void __cdecl SalieriFoundation::Globals::Func(class std::basic_string < unsigned short,struct std::char_traits < unsigned short > ,class std::allocator < unsigned short > > const &)" (?Func@Globals@SalieriFoundation@@YAXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z) referenced in function _main<br />
Edit: as asked by first reply changed the linker error message - added some spaces to avoid HTML-like text. Also I actualy have namespaces that you can see in the error message so I added in the above sample code - but I don't think it makes any diff.
What's wrong?
_UNICODE is defined in both projects.
I'm tying to find it for like 6 hours. Please help.
|
|
|
|
|
Can you please edit the linker error message to include the first template parameter for basic_string - code project has eaten it because it looks like an HTML tag.
Dave
|
|
|
|
|
Ok. I did. Check it out.
Thanks a lot.
|
|
|
|
|
Are you sure it is linking with the unicode version of the static library? If both the unicode and ansi versions have the same filename (which is never a good idea), then it is possible that it is finding the ansi version first, and so never finding your unicode version of the function.
Dave
|
|
|
|
|
Interesting, but I'm trying to rely on those "dependencies". Bad idea, huh?
OK. Let me try more explicit linkage...
|
|
|
|
|
|
You know what? No!
Wierd. I know now that the lib is correct. At least as unicode goes.
|
|
|
|
|
Anyone knows a reason why this would not paint my items/sub items ?
case WM_NOTIFY:
{
switch(LOWORD(wParam))
{
case IDC_LIST:
{
if(((LPNMHDR)lParam)->code == NM_CUSTOMDRAW)
{
NMLVCUSTOMDRAW *cdraw = (NMLVCUSTOMDRAW*)lParam;
if (cdraw->nmcd.dwDrawStage == CDDS_PREPAINT)
return CDRF_NOTIFYITEMDRAW;
if (cdraw->nmcd.dwDrawStage == CDDS_ITEMPREPAINT || cdraw->nmcd.dwDrawStage == CDDS_SUBITEM)
{
COLORREF crText;
if ( cdraw->iSubItem==2 )
crText = RGB(255,0,0);
else if ( cdraw->iSubItem==1 )
crText = RGB(0,255,0);
else
crText = RGB(128,128,255);
cdraw->clrText = crText;
return CDRF_DODEFAULT;
}
}
}
}
}
the message never arrives at if (cdraw->nmcd.dwDrawStage == CDDS_ITEMPREPAINT || cdraw->nmcd.dwDrawStage == CDDS_SUBITEM)
i have seen other src codes and it all works well there (MFC examples but not API)
any brief idea?
/- Bengi - \
|
|
|
|
|
any idea? i kinda need this one fixed badly!
/- Bengi - \
|
|
|
|
|
Have you seen Michael Dunn's article on Custom-Draw in List boxes? It's on this site (can't find link - it's entitled "Neat Things to do with CListCtrl using Custom Draw") - I have successfully followed that example to colour my List Box
-Alex
|
|
|
|
|
Hi!
I have a CDialogBar derived class, and I want to enable/disable some button in it.
Inside of my class, I catch the click button events for my buttons.
ON_BN_CLICKED(IDOKUNDCERVCREAT, OnBnClickedOk)
ON_BN_CLICKED(IDC_COMPUTEUNDCERVCREAT, OnBnClickedCompute)
ON_BN_CLICKED(IDC_DESTROYUNDCERVCREAT, OnBnClickedDestroy)
I have connected my buttons with my variables:
DDX_Control(pDX, IDOKUNDCERVCREAT, m_wndOk);
DDX_Control(pDX, IDC_COMPUTEUNDCERVCREAT, m_wndCompute);
DDX_Control(pDX, IDC_DESTROYUNDCERVCREAT, m_wndDestroy);
in my *.h I have:
CButton m_wndOk;
CButton m_wndCompute;
CButton m_wndDestroy;
So, in my OnButtonClickFunct.. I want to do things like:
m_wndOk.EnableWindow(false);
m_wndCompute.EnableWindow(false);
Right now, if I do that, my button dont enable/disable.
thanks for the help
Everything's beautiful if you look at it long enough...
|
|
|
|
|
Because, you haven't made the connection between the m_wndOk variable and the IDOKUNDCERVCREAT control, enabling m_wndOk won't do anything. The easiest way to achieve what you want is to lose the variables and just do:
GetDlgItem (IDOKUNDCERVCREAT)->EnableWindow (false); /ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I tryed it, but It don't seems to work. Maybee the fact that it is a dialogBar unstead of a dialog prevent this from working.
any other ideas?
Everything's beautiful if you look at it long enough...
|
|
|
|
|
MemLeak wrote:
Maybee the fact that it is a dialogBar unstead of a dialog prevent this from working.
I don't think so. It's likely that there may be other problems in your code.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello,
I have an application which is using AviCap to occasionally grab a frame from a camera using a frame callback. I would like to convert this frame data into a bitmap or DIB (in memory). For testing purposes I have a static control (m_Pic) declared globally (for ease in testing) in which to display the bitmap to. I know the callback is working correctly because the static control turns black and resizes to the size of the captured imaged.
I've read through the samples here and at a few other places and I'm looking for a very simple method to get the image data without using any sort of custom class. Any help would be appreciated.
Thanks,
Aaron Stubbendieck
LRESULT FAR PASCAL FrameCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr)<br />
{<br />
VOID* data=NULL;<br />
data=malloc(lpVHdr->dwBytesUsed);<br />
ZeroMemory(data,lpVHdr->dwBytesUsed);<br />
memcpy(data,lpVHdr->lpData,lpVHdr->dwBytesUsed);<br />
<br />
BITMAPINFO BitmapInfo;<br />
capGetVideoFormat(hWnd,&BitmapInfo,sizeof(BitmapInfo));<br />
<br />
HBITMAP hBitmap=::CreateDIBSection(0,&BitmapInfo,DIB_RGB_COLORS,&data,NULL,0); <br />
<br />
CBitmap bmp;<br />
bmp.Attach(hBitmap);<br />
m_Pic.SetBitmap(hBitmap);<br />
<br />
delete data;
<br />
return (LRESULT)TRUE;<br />
}
modified 12-Jul-20 21:01pm.
|
|
|
|
|
seems like I need some help trouble shooting again.
My app uses MS Speech API 5.1[^] and need to include the API for Win98 users. Problem is I am not sure which files to include? I have tried the Redistributable .msm[^]
Speech SDK merge modules (MSM)
The following merge modules can be redistributed:
sp5.msm
sp5intl.msm
sp5sr.msm
sp5ccint.msm
sp5itn.msm
sp5ttint.msm
spcommon.msm
sp5ttintxp.msm
The ones in bold are the ones I did not try installing.
Any ideas would be great thanks.
I think they installed properly but but app crashes when a speech function is called.
<edit added>
maybe I didn't create the installation correctly?
www.savemall.net/mshelp.htm[^]
</edit added>
Later, JoeSox www.joeswammi.com It's not easy facin' up when your whole world is black Rolling Stones
|
|
|
|
|
(rant, no help here...)
I have part of an application that is SAPI enabled. It worked ok. I really didn't like that the end user would still need to get a speech engine. I could have sworn the ones that came with SAPI were only part of the SDK and not intended for end-user distribution. (??)
We finally ended up not enabling this part of the software over concern about support issues. It really did seem like a huge support quagmire. I would love to hear from people who actually ship this stuff and the resulting support costs.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|