|
Thanks Nathan,
Nathan Holt at EMOM wrote: The & is used to create a reference to the SPREADSHEET that will act like a value. In many cases, this is a good way to avoid using * for all your variable references, and to make sure you don't accidentally change the value of the pointer it hides. In this case, the effects are complicated by the way pointers act like arrays, so this might not be good code to start learning from.
This & references to array's address?
To me cast into user defined type in this scenario is just like stuff the memory into the target type's structure in byte.
|
|
|
|
|
|
A user interface? All I see is an image.
|
|
|
|
|
|
done. where do i send it now ?
|
|
|
|
|
Simply upload an image, that'll be fine
|
|
|
|
|
Really?
followait@163.com
or
followait@hotmail.com
|
|
|
|
|
ohhh, no no no, it took me time to do it ! i want to be payed !
you can use my paypal account for that (same Id as my nickname)
|
|
|
|
|
Check your link. I suppose it is a warning telling us that there is no image available but there is only chinese characters.
|
|
|
|
|
Sorry.
But the image is there.
|
|
|
|
|
I have some chinese letters and a "prohibited" symbol.
BTW, a GUI can be done in a few minutes or in days. It directly depends on what you want to do. Just asking "How much time need a GUI?" is no sense sorry.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
|
Hi,
There are certain sub-classes that I use often in many projects. For example CMyDialog, CMyFormView... Each time I have to use CMyDialog instead of CDialog I have to rename CDialog to CMyDialog in the .cpp and .h files.
Is there any way to add CMyDialog, CMyFormView to the list of base classes so that this derivation is done automatically while creating a new dialog/formView class?
Thanks.
Tara
Fortitudine Vincimus!
|
|
|
|
|
I don't know if there is a way, but I guess is not a good idea to go into the core of the MFC and modify things.
I personally find the CTRL+H (search and replace all) very usefull for that moment, and is just a few seconds.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi, I need help with a C++ Win32 GDI project I am working on in both Bloodshed Dev C++ and Visual C++ 6.0 and Up in Windows XP SP2.
What my program does is moves a ball (circle) arround the screen corresponding to arrow keys, and a fixed cross that reappears as the ball passes over it. The problem is that when I do the BitBlt, it draws a square instead of a circle, so a square is overwriting the cross (basically, a circle with a white square region around it. Is there a way to do this BitBlt with just the circle and not the square because this is annoying. In other words, I don't want a square region overwriting the cross - just the circle.
Here is what I have so far:
----------------------------
#include <windows.h>
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
/* Make the class name into a global variable */
char szClassName[ ] = "WindowsApp";
static HANDLE hBitmap;
static HBRUSH hBrush;
static HDC hdc;
static HDC hdcMem;
static int cxClient;
static int cyClient;
static int xCenter = 100;
static int yCenter = 100;
static int objSize = 100;
static int cxTotal;
static int cyTotal;
static int cxRadius;
static int cyRadius;
static int cxMove;
static int cyMove;
static int xPixel;
static int yPixel;
static int nScale;
static bool flag = false;
static int crossx = 100;
static int crossy = 100;
double MAX (double a, double b)
{
if (a > b)
{
return a;
}
return b;
}
double MIN (double a, double b)
{
if (a < b)
{
return a;
}
return b;
}
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called by
windows */
wincl.style = CS_HREDRAW | CS_VREDRAW; /* Catch
double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after the
window class */
wincl.cbWndExtra = 0; /* structure or the window
instance */
/* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Windows App", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
800, /* The programs width */
600, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
ShowWindow (hwnd, nFunsterStil);
/* Run the message loop. It will run until GetMessage() returns 0 */
while (GetMessage (&messages, NULL, 0, 0))
{
/* Translate virtual-key messages into character messages */
TranslateMessage(&messages);
/* Send message to WindowProcedure */
DispatchMessage(&messages);
}
/* The program return-value is 0 - The value that PostQuitMessage() gave
*/
return messages.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam)
{
switch (message) /* handle the messages */
{
case WM_DESTROY:
if (hBitmap)
{
DeleteObject(hBitmap);
}
PostQuitMessage (0); /* send a WM_QUIT to the message queue
*/
break;
case WM_CREATE:
hdc = GetDC(hwnd);
xPixel = GetDeviceCaps(hdc,ASPECTX);
yPixel = GetDeviceCaps(hdc,ASPECTY);
ReleaseDC(hwnd,hdc);
return 0;
case WM_PAINT:
hdc = GetDC(hwnd);
hdcMem = CreateCompatibleDC(hdc);
if(flag)
{
RECT rc;
rc.left = 0;
rc.top = 0;
rc.right = 800;
rc.bottom = 600;
FillRect(hdc, &rc, (HBRUSH)RGB(0,0,0));
MoveToEx(hdc, crossx, crossy, NULL);
LineTo(hdc, crossx+50, crossy);
LineTo(hdc, crossx+50, crossy-50);
LineTo(hdc, crossx+75, crossy-50);
LineTo(hdc, crossx+75, crossy);
LineTo(hdc, crossx+125, crossy);
LineTo(hdc, crossx+125, crossy+25);
LineTo(hdc, crossx+75, crossy+25);
LineTo(hdc, crossx+75, crossy+75);
LineTo(hdc, crossx+50, crossy+75);
LineTo(hdc, crossx+50, crossy+25);
LineTo(hdc, crossx, crossy+25);
LineTo(hdc, crossx, crossy);
}
SelectObject(hdcMem,hBitmap);
BitBlt(hdc,xCenter-cxTotal/2,yCenter-cyTotal/2,cxTotal,cyTotal,hdcMem,0,0,SRCC
OPY);
ReleaseDC(hwnd,hdc);
DeleteDC(hdcMem);
flag = false;
return 0;
case WM_MOVE:
hdc = GetDC(hwnd);
MoveToEx(hdc, crossx, crossy, NULL);
LineTo(hdc, crossx+50, crossy);
LineTo(hdc, crossx+50, crossy-50);
LineTo(hdc, crossx+75, crossy-50);
LineTo(hdc, crossx+75, crossy);
LineTo(hdc, crossx+125, crossy);
LineTo(hdc, crossx+125, crossy+25);
LineTo(hdc, crossx+75, crossy+25);
LineTo(hdc, crossx+75, crossy+75);
LineTo(hdc, crossx+50, crossy+75);
LineTo(hdc, crossx+50, crossy+25);
LineTo(hdc, crossx, crossy+25);
LineTo(hdc, crossx, crossy);
ReleaseDC(hwnd,hdc);
return 0;
case WM_SIZE:
xCenter = (cxClient=LOWORD(lParam))/2;
yCenter = (cyClient=HIWORD(lParam))/2;
nScale = (int)MIN(cxClient*xPixel,cyClient*yPixel)/16;
cxRadius = nScale/xPixel;
cyRadius = nScale/yPixel;
cxTotal = 2*(cxRadius+cxMove);
cyTotal = 2*(cyRadius+cyMove);
if (hBitmap)
{
DeleteObject(hBitmap);
}
hdc = GetDC(hwnd);
hdcMem = CreateCompatibleDC(hdc);
// hdcCross = CreateCompatibleDC(hdc);
MoveToEx(hdc, crossx, crossy, NULL);
LineTo(hdc, crossx+50, crossy);
LineTo(hdc, crossx+50, crossy-50);
LineTo(hdc, crossx+75, crossy-50);
LineTo(hdc, crossx+75, crossy);
LineTo(hdc, crossx+125, crossy);
LineTo(hdc, crossx+125, crossy+25);
LineTo(hdc, crossx+75, crossy+25);
LineTo(hdc, crossx+75, crossy+75);
LineTo(hdc, crossx+50, crossy+75);
LineTo(hdc, crossx+50, crossy+25);
LineTo(hdc, crossx, crossy+25);
LineTo(hdc, crossx, crossy);
hBitmap = CreateCompatibleBitmap(hdc,cxTotal,cyTotal);
ReleaseDC(hwnd,hdc);
SelectObject(hdcMem,hBitmap);
Rectangle(hdcMem,-1,-1,cxTotal+1,cyTotal+1);
hBrush = CreateHatchBrush(HS_DIAGCROSS,0);
SelectObject(hdcMem,hBrush);
SetBkColor(hdcMem,RGB(0,127,255));
Ellipse(hdcMem,cxMove,cyMove,cxTotal-cxMove,cyTotal-cyMove);
DeleteDC(hdcMem);
DeleteObject(hBrush);
return 0;
case WM_KEYDOWN:
switch(wParam)
{
case VK_LEFT:
xCenter -= 10;
flag = true;
break;
case VK_RIGHT:
xCenter += 10;
flag = true;
break;
case VK_UP:
yCenter -= 10;
flag = true;
break;
case VK_DOWN:
yCenter += 10;
flag = true;
break;
}
SendMessage(hwnd, WM_PAINT, 0, 0);
return 0;
default: /* for messages that we don't deal with
*/
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
Jason Cohn
|
|
|
|
|
Did you try it with a CRgn or HREGION ?
Greetings from Germany
|
|
|
|
|
usually a well chosen raster operation (such us SRCPAINT, instead of SRCCOPY) does the trick (of course you have to choose bitmap colors accordingly)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
You can use the TransparentBlt[^] for that operation. Simply specify the color that shouldn't be visible from your source bitmap (in your case, it will be white).
|
|
|
|
|
I am trying to extract cell contents from an excel spreadsheet into a VS6 C++ application. I am using a CRecordset object set up with an ODBC datasource to my spreadsheet. My problem is that some of the cells contain text with formatting such as bold and italics. I need this formatting to be preserved but unfortunately my m_RecordSet.GetFieldValue() calls are only pulling over the plain text.
Is there a way of preserving the formatting and what form would it be in? RTF?
Martin Smithurst
Developer Extraordinaire(ily stressed)
-- modified at 10:20 Wednesday 21st November, 2007
|
|
|
|
|
I am using MFC Doc/View Architecture in Visual Studio 6.0.
I created a dialog and inserted a Activex picture control into it...
But when I run my application the dialog where i inserted my aciveX
Component is not visible or not showing .... why ?
If anyone know the answer please help me .....
|
|
|
|
|
Hi,
Yesterday I made my first Project Wizard and it's working like a charm!! Now there is a little feature I'd like to add:
- All the project is based on classes derivated from GameState class
- The current wizard creates a GameState derivated class as a start
- I need to put a wizard in the Add Item box, so the programer can add a new derivated class if he wants to create another game state. (It should create the .cpp and .h files). This wizard should also shows a screen so the programer choose between the game states I provide.
Thanks,
Dirso
|
|
|
|
|
hai all,
here iam facing some problem with deletefile.
it goes like this,
1.if i create a file using windows(rightclick>new>text document) and delete it through code then it is working.
2.if i create a file using FILE *fp;
and try to delete it, then it is unable to delete it.
iam unable to analyse any more on it.
please give your ideas and different possibilities to solve the problem.
or if any body can suggest any other technique, which works, it would be appreciable.
|
|
|
|
|
Are you closing the created/opened file before trying to delete it?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
YES iam closing the files(fclose).
and more over, the files were created in previous sessions. not in the session where iam trying to delete them.
and my files have the extension .cry does it matter?
here are some case studies.
1.iam trying to delete the s1.cry(created by my application) like this
filename="s1.cry";
DeleteFile(rootpath+"\\cryfiles\\"+filename);
RESULT : no use.
2.now i rename it through windows like s1.cry1 and
filename="s1.cry1";
DeleteFile(rootpath+"\\cryfiles\\"+filename);
RESULT : successful.
any ideas?
|
|
|
|
|
I make it like follows:
void CMyView::OtherFunction ()
{
char FileName[MAX_PATH];
GetModuleFileName(NULL, FileName, MAX_PATH);
m_szOfflineName = FileName;
m_szOfflineName = m_szOfflineName.Left(m_szOfflineName.ReverseFind('\\'));
m_szOfflineName += "\\OfflinePCode.pc";
}
.
.
void CMyView::OnDestroy()
{ CFormView::OnDestroy();
CFile f;
if (f.Open (m_szOfflineName, CFile::modeRead))
{ f.Close ();
f.Remove (m_szOfflineName);
}
}
But I am in MFC, I dont know if u can use the CFile
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|