|
oops again!
as I said that's for controls.
for affecting your TextOut calls
use SelectObject(GetDC(hWnd),hFont)
Nish
|
|
|
|
|
I guess he is already in a WM_PAINT proc. and thus have a valid HDC handle. This should allow him to use
::SelectObject(hdc, hFont);
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
hi. there's two things bugging my mind recently. The first is this:
i made a win32 dialog based application without MFC. I added a ListView on the dialog and when i tried to run the program it wouldn't show the dialog window. The process was running but it just didn't show the dialog which had the control on it. Now i realise that Active-x controls and things like that cant be used without initializing some things first, but this isn't an active-x control is it??? If it is, please tell me, and possible inform me on how to initialize active-x components in a win32 project.
The second thing is simple, allthough it could be i posted something about it before on this board i'm not quite sure. I just want to know if it is possible to take an MFC class, like for example "CSocket" and use it in a win32 project. I realise you would have to make some changes but for now i just want to know if it is possible.
Thanks
Kuniva
|
|
|
|
|
Without seeing your source code, I can't think what the problem is. You did remember to call BOOL InitCommonControlsEx
Does it show the dialog if the listview32 isn't on it?
Michael
|
|
|
|
|
did you show the window after creating it ShowWindow(SW_SHOW) and is your window class registered.
Some of the MFC classes can be used standalone, particularly the those that do not include a view. CTime and CString are typical ones that would be used.
I haven't done it with a Socket, but I have taken some diagnostic ones. It is a matter of including the right headers (and sub headers) and setting the right #defines to enable the parts your functions need (otherwise done for you by a wizard). You can see a list of these in .h files and the right Linked dlls. Remember that the controls are all based on CObject too so as far as 'visible' objects are concerned you are not able to ignore the MFC4xx.dll's altogether, I'm afraid I don't have my list of whats in each one anymore.
We do it for the joy of seeing the users struggle.
|
|
|
|
|
I have a CFormView and inside it is a CPropertySheet with
5 property pages. The property pages are identical. I typed:
CMyPropertySheet.h
------------------
#include "MyPage1.h"
...
CMyPage1 page1;
CMyPage1 page2;
CMyPage1 page3;
CMyPage1 page4;
CMyPage1 page5;
and then I added the pages. It works, but for awhile. Then I
get a Fatal Exception Handling error and the computer just goes
nuts! I have to reboot. I know I am doing something wrong, but
I don't know how to resolve it unless I have 5 separate classes
and 5 separate IDD_PAGE1, IDD_PAGE2, rather than just 1.
Any way of reusing code without getting massive errors?
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
I am running DOS on my embedded system and I need to be able to send data back through the net. I am using Borland Turbo C. Does anyone know of any code that I can use to handle the TCP\IP stack, like Windows Socket API for Win32?
Please help.;)
|
|
|
|
|
|
The link from Nish sums it up well.
From DOS 5 upwards there is built in calls to help in this sort of communications. I have a DOS Bible (somewhere arround here) if you can get hold of one of those then you will see a list of all DOS calls and the parameters used. You can speedup your embedded systems no end if you use these rather than allowing the C interface to do it.
A typical one that the C compilers did was to use the indirect functions of DOS to write to the screen, it is legal in DOS to use one its more direct screen writeing calls.
There is also a FileIO function (off the top of my head call 24 or 42) that covers just about any communications you could need, including IP.
We do it for the joy of seeing the users struggle.
|
|
|
|
|
I have the need to access a named pipe over a network where both sides are Windows NT 4.0 machines. The pipe server is implemented as an NT service while the client request will originate from an ATL COM dll. I have zero problems if I invoke the COM object from my test application; the two machines "talk" to each other, transfer data back and forth, etc.
My problem is when the COM object is invoked as a result of IIS activity. In this case, my cgi application (written in VC++) creates the COM object. The COM object then attempts to connect to the pipe using CreateFile(). I am sure this is a problem with the security attributes setting for the client side, at this point the arguement is set to NULL.
BTW - the named pipe is created WITH security attributes... A SD is declared, then initialized using InitializeSecurityDescriptor() and set using SetSecurityDescriptorDacl(). sa.lpSecurityDescriptor is then set to the SD.
So, any ideas on how I might resolve this little problem??
TIA,
Barry
|
|
|
|
|
Barry, I think security attributes defined by your server prohibit access to pipe. When you create named pipe (server side) you specify, who can access it. However, local system account from another machine has no right to access resources on the remote machine (your scenario, when COM object created by IIS access named pipe).
I would recommend two solution:
1. set security attributes to allow access for everyone (bad, not secure solution)
or
2. impersonate client COM object to proper user account to access remote resources (your named pipe).
I hope this will help you.
Kind regards.
Martin
|
|
|
|
|
When you "execute" a COM object from a cgi application, it is running in the local anonymous web-user's security context (IUSER_something), that user normally dont have the rights to access the remote machine. The problem is the same with the system account when running from a server.
The most easy way, AFAIK, is to get people to log on the webserver, instead of being anonymous users, then the COM object executes in their security context, and then it might have the rights to access the remote server.
I *think* there is a way to say to IIS that "this application (your CGI app) should run as this user", but right now I don't remember how to do it...
You can also say that anonymous users on IIS should run as a domain user that you select, then they have the rights to access other computers on the network, but then you have a huge security risk...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi
Does anybody knows how to make the following only with bit operations
if( a1==b1 )
a1 = c1;
|
|
|
|
|
Is this sufficient solution?
if (!(a1 ^ b1)) a1 = c1;
|
|
|
|
|
Thank you, but I do not want to use if
|
|
|
|
|
What about:
a1 = !(a1 ^ b1) ? c1 : a1;
BTW, what's the reason to not use 'if'?
|
|
|
|
|
|
|
Chris,
I don't see where the assignment of a to c1 takes place in your expression. Could you clarify, or is it just a joke?
Regards,
Alvaro
|
|
|
|
|
|
Hi all, I have managed to load/create (as necessary) a 24-bit DIBSection using the means described on this very web site (LR_CREATEDIBSECTION flag in LoadImage and CreateDIBSection), both of which return a HBITMAP. Superb. What I want to do now is "grab" the actual BGR colour values that make up each pixel, and change them to something else such as RGB(0,255,0 - Green, its the easiest example to use). At the moment I am trying to get the bits using a BITMAP structure (returned through GetObject) and its bmBits property. I have also implemented Christians wizardry to convert this pointer to a valid LPBYTE by :
for (int y=0, y < bm.bmHeight, y++)
{
LPBYTE pbSrcRGB = (LPBYTE)&((DWORD*)pDestBits)[y*bm->bmWidth]
for (int x=0, x < bm.bmWidth, x++)
{
pbSrcRGB[0]=0
pbSrcRGB[1]=255
pbSrcRGB[2]=0
pbSrcRGB+=3
}
}
However, the program crashes out after a few laps of the for loops. I have also checked to see whats in pbSrcRGB at position [0] BEFORE assignment and every time it has :
0 ''
it is NULL terminated. How is this remedied? BITMAP structure is passed into this function by :
&bm
and a LPBITMAP structure is then used (as you can see from bm->), so I would have thought that everything was OK from the BITMAP point of view. Also the bitmap starts off black (which I don`t want, thats why I`m changing it all to green), so I assume this is why it reads 0 ''. Also when I check pbSrcRGB[0] to see what it contains AFTER assignment, it reads :
255 'y' (with funny line over the top of the y)
Why does this happen?
The main essence of my questions are aimed at discovering :
a) why the program could be crashing out.
b) why the pixel colours on the screen don`t change when the memDC is blit to pDC (the screen device context).
Any help would be hugely appreciated as you can imagine. I`ve been working on this for a while, and just can`t figure it out. I`ve checked a lot of articles, but to this day I can`t find one that even attempts to shed light on the situation (except Christians - but the article didn`t really target the issue). If you`ve read this far down, I thank you for that even if you don`t know the answer,
Cheers,
Alan.
P.S. On a slightly different aspect, is there anyway of creating a DIB and intialising its colour to white instead of black?
AEGC
|
|
|
|
|
try using the <pre>...<pre> tags around code sections. and use < for &"<" characters.
about the NULL-terminated and funny-Y characters - don't worry about them. the debugger is displaying the BYTEs as characters.
http://www.smalleranimals.com
|
|
|
|
|
Cheers for page authoring advice, it looks much prettier now. So you think everything seems fine, but why does the app crash out? and why do the colours not change?
Cheers for the response,
Alan.
AEGC
|
|
|
|
|
this code might help:
int nPad = ds.dsBm.bmWidthBytes - (((ds.dsBmih.biWidth *
ds.dsBmih.biBitCount) + 7) / 8);
LPBYTE pbBits = (BYTE*) ds.dsBm.bmBits;
for (i=0; i<ds.dsBmih.biHeight; i++)
{
for (j=0; j<ds.dsBmih.biWidth; j++)
{
*(pbBits+0) = 0;
*(pbBits+1) = 255;
*(pbBits+2) = 0;
pbBits+=3;
}
pbBits += nPad;
}
http://www.smalleranimals.com
|
|
|
|
|
Well, you truly are a magician of the C++ variety, the code example you gave me worked superbly. However, there is one slight problem which is preventing me from tarring you with the same golden brush as Gandalf the Great. The bitmap goes green alright, but for only a second, and then where I draw some lines in some code after it, it flicks back to bl**dy black. Please enlighten me.
Also, I just like to thank you for that piece of code you gave me, for the page authoring tips you mentioned, and, well...for bothering to reply at all.
Cheers mate, I owe you one,
Alan.
|
|
|
|