|
I am wondering how can I create a simple function that will return the current second,minutes and hour in a 3 dimensional int array. I been looking at the information on ctime in windows to see how I could do this but I havent found what I needed. I dont want the function to pause or anything I just want it to simply return the second, minutes and hours.
|
|
|
|
|
Check GetSystemTime
or time_t time( time_t *timer );
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Supaflyfrank wrote:
...return the current second,minutes and hour in a 3 dimensional int array.
What is this? A 3D int array looks like:
int arr[x][y][z]; How do you propose to fill that up with "second, minutes and hour?"
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
int arr[1][1][1];
perhaps...
But I can't help to think that a better way to store time is in a structure like this:
<br />
struct TIME<br />
{<br />
int m_nSeconds;<br />
int m_nMinutes;<br />
int m_nHours;<br />
};<br />
There probably is a predefined structure like that.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Bob Stanneveld wrote:
There probably is a predefined structure like that.
Several, actually.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I will look in to see if their is any structure already made. But I was more thinking of a array like this: int Time[3]; Time[0] Would be hours Time[1] Would be minutes and Time[2] Would be seconds.
|
|
|
|
|
Hi,
I am inserting a flash control in my application (Win32 API application no MFC) and now I have to implement GetMoniker of IOleObject... How can I do that?
Thank you very much in advance for your answers...
Well... I am a beginner ...
|
|
|
|
|
Hello there,
I am trying to create a modeless dialog-box dynamically, without using a resource image file. The following code illustrates my (useless) effort so far:
BOOL CDlg::Setup()
{
DLGTEMPLATE DlgTemplate;
WORD MenuNull = NULL;
WORD ClassNull = NULL;
WORD TitleNull = NULL;
int nScrHeight;
int nScrWidth;
RECT rect;
nScrWidth = ::GetSystemMetrics(SM_CXSCREEN);
nScrHeight = ::GetSystemMetrics(SM_CYSCREEN);
DlgTemplate.cx = nScrWidth / 5;
DlgTemplate.cy = nScrHeight >> 2;
DlgTemplate.x = nScrWidth - DlgTemplate.cx;
DlgTemplate.y = 0;
DlgTemplate.cdit = 0;
DlgTemplate.style = WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | DS_3DLOOK;
DlgTemplate.dwExtendedStyle = 0;
if(!CreateIndirect(&DlgTemplate))
return FALSE;
.
:
.
After calling CDialog::CreateIndirect, there is an error that occurs at WinAPI level -- Error 1813 -- The specified resource type cannot be found in the image file.
If you could please tell me what I am doing wrong here, I would greatly appreciate it!
Thank you so much,
David Nimrod
|
|
|
|
|
CreateIndirect was not provided to allow dynamic creation of dialogs like you pretend, so its interface is evily complicated. If you go to the docs for DLGTEMPLATE[^], it is said that this structure must be followed in memory by a bunch of other binary information. As you haven't provided this, CreateIndirect dives into random memory hence the result.
So, you must construct a block of memory according to what CreateIndirect expects, possibly with the minimum information necessary. What has to be written is described here[^]. Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have created a pointer to a shared memory, but I need to be able to access variables (not bit fields - they will be done by word) via an offset from the start of the memory location. I have an array of all the offsets to each variable, but dont know how to setup a pointer to the memory area and how to obtain each variable's data using this offset.
The structure contains bit fields, which must remain so cant use the offsetof macro.
#pragma pack(1)<br />
typedef struct<br />
{<br />
unsigned short i; <br />
float f; <br />
char c; <br />
unsigned short bit41 : 4;<br />
unsigned short bit42 : 2;<br />
unsigned short bit43 : 1;<br />
char s;<br />
unsigned short x;<br />
double y;<br />
double z;<br />
} SFOO;<br />
<br />
struct TSharedMemory {<br />
union<br />
{<br />
SFOO fields;<br />
unsigned short buffer[32];<br />
}test_data;<br />
);<br />
#pragma pack()
Note I have used CreateFileMapping and
MapViewOfFile, which is OK for access via the structure, but its for access via the array of offsets that I cant seem to do.
i.e. setup pointer to start of the shared memory and access via this pointer and the offsets.
Any suggestions please.
|
|
|
|
|
Whatever the way you get you offset, to access the correct member of the structure you should do:
void *pvIntrinsic pointer to your data
pvFieldPtr = ((char *) pvIntrinsic) + uOffset
Then do the correct cast on it
eg: for a double value
*(double *) pvFieldPtr = doubleValue;
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks that was what I was looking for.
Just one final question regarding casting. Are they any way I can do a more generalised cast or must it be to the correct type.
Thanks again,
Sweep
|
|
|
|
|
It should be the correct cast, because the size written or read from memory is affected.
A way to solve the issue, let another member in your struct hold the type, and based on it you'll do your cast (enum like member: TYPE_INT, TYPE_FLOAT, TYPE_ ...)
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Declare a pointer to a SFOO :
struct SFOO *psfoo;
Set the pointer to the address you want :
psfoo = (struct SFOO *)( (char *)BasePointer + offset );
Then you can use standard pointer references :
<br />
psfoo->x = 42;<br />
psfoo->y = 3.141596;<br />
__________________________________________
a two cent stamp short of going postal.
|
|
|
|
|
hi all.. how to display tiff and jpg images on my dialog-based application?
I search for it and they seems too complicated to understand.
I have list of file names want to display one at the time on the dialog when the user click on next or previous button. But I have no experience and no idea of displaying image on the dialog.
Can anyone please tell me how to display tiff and jpg images on dialog Please..
Thanks
|
|
|
|
|
|
I'm trying to create a filter dropdown similar to Excel AutoFilter feature in a report style CListView. Basically, what I want is a list to pop up when the user clicks on the column heading. When they select an item in the list, the list control redraws itself to include only rows containing the selected value. Any ideas on how to proceed?
Thanks,
Andrew Westberg
|
|
|
|
|
how about making a _PopUp_ menu? You will have to add the CMenu object to your code then #define the ID's for each menu item. Then in your form's OnCommand() function do a switch() statement to see if it's one of the ID's you specified for one of your menu items and take the appropriate action. If this still doesn't help, let me know and I'll try to dig up some code.
[insert witty comment here]
bdiamond
|
|
|
|
|
Sounds like a good idea. I'll use the LVN_COLUMNCLICK event to add items and track my popup menu. Thanks for the idea.
|
|
|
|
|
Would anyone provide sample source code on this topic?
|
|
|
|
|
How exactly do I get it to draw gray icons? I'm trying to draw icons the way toolbars draw disabled icons (see IE6 toolbar). What part/state am I supposed to call it with?
I've tried pretty much everything, and it still draws a non-gray icon.
--
...Coca Cola, sometimes war...
|
|
|
|
|
See DrawState and specify DSS_DISABLED.
- Jeremy
|
|
|
|
|
Ah yes, but it doesn't quite do it. Themed toolbars are grayed as in black and white when disabled. DSS_DISABLED embosses the image, which isn't quite what I want.
I will take a look at CxImage here on CP tomorrow. I think it has what I need.
--
...Coca Cola, sometimes war...
|
|
|
|
|
Check out DitherBlt from WTL then. It's in atlgdi.h.
|
|
|
|
|
Been there, done that.
If you take a look at the toolbar (coolbar/rebar or whatever microsoft calls it) in IE, you'll see what I mean. The icons are just desaturated. No 3D effects are applied at all. I don't think a simple blit will do the trick for me, unless you or someone knows a clever way to do it with XOR/AND/OR bitblt magic.
--
...Coca Cola, sometimes war...
|
|
|
|