Why does PpGetPC return NULL?

Hi!

The following function-calls return NULL, and I do not know why.

PpGetPC(pc,Pp_PC_DRIVER,&pc_data);
PpGetPC(pc,Pp_PC_FILENAME,&pc_data);
PpGetPC(pc,Pp_PC_NAME,&pc_data);

The description of PpGetPC says:
“Returns:
A pointer to the requested data, or NULL if an unrecognized member was
specified.”

Are Pp_PC_DRIVER, Pp_PC_FILENAME and Pp_PC_NAME unrecognized members? It
would be surprising.

PpGetPC works fine with other members (for example Pp_PC_DEVICE,
Pp_PC_PAPER_SIZE, Pp_PC_ORIENTATION, etc.)

What is the problem?
Thanks.

Hi Laszlo,

Are you using PpSetPC() function to set any of these members? If you check
these values right after creating a print context they will not have any
values stored in them. Can you post a code snipped showing the problem your
seeing ?

For example:
void *pc_data;
PpPrintContext_t *pc = PpCreatePC();

PpGetPC(pc, Pp_PC_NAME, &pc_data);
if(pc_data)
printf(“printer name: %s\n”, (char *)pc_data);
else
printf(“printer name 0x%x\n”, pc_data);

PpSetPC(pc, Pp_PC_NAME, “Some Name”);
PpGetPC(pc, Pp_PC_NAME, &pc_data);
if(pc_data)
printf(“printer name: %s\n”, (char *)pc_data);
else
printf(“printer name 0x%x\n”, pc_data);

The output should look something like…
printer name: 0x0
printer name: Some Name

Regards
Brenda


“Laszlo Nagy” <lnagy@mail.sednet.hu> wrote in message
news:c26sqi$ju$4@inn.qnx.com

Hi!

The following function-calls return NULL, and I do not know why.

PpGetPC(pc,Pp_PC_DRIVER,&pc_data);
PpGetPC(pc,Pp_PC_FILENAME,&pc_data);
PpGetPC(pc,Pp_PC_NAME,&pc_data);

The description of PpGetPC says:
“Returns:
A pointer to the requested data, or NULL if an unrecognized member was
specified.”

Are Pp_PC_DRIVER, Pp_PC_FILENAME and Pp_PC_NAME unrecognized members? It
would be surprising.

PpGetPC works fine with other members (for example Pp_PC_DEVICE,
Pp_PC_PAPER_SIZE, Pp_PC_ORIENTATION, etc.)

What is the problem?
Thanks.

Hi Brenda!
Thank you for the answer. It was my fault. I’ve created a print context,
a PtPrintsel widget and I set Pt_ARG_PRINT_CONTEXT resource. After the
user finished selecting the printer, I did not get the modified print
context by using PtGetResource(). I assumed that the print context I set
to Pt_ARG_PRINT_CONTEXT is updated automatically when the user
configures the print session. Now I see in the documentation, that I
have to get the modified print context by using PtGetResource().
Thanks very much.
Laszlo



GUI wrote:

Hi Laszlo,

Are you using PpSetPC() function to set any of these members? If you check
these values right after creating a print context they will not have any
values stored in them. Can you post a code snipped showing the problem your
seeing ?

For example:
void *pc_data;
PpPrintContext_t *pc = PpCreatePC();

PpGetPC(pc, Pp_PC_NAME, &pc_data);
if(pc_data)
printf(“printer name: %s\n”, (char *)pc_data);
else
printf(“printer name 0x%x\n”, pc_data);

PpSetPC(pc, Pp_PC_NAME, “Some Name”);
PpGetPC(pc, Pp_PC_NAME, &pc_data);
if(pc_data)
printf(“printer name: %s\n”, (char *)pc_data);
else
printf(“printer name 0x%x\n”, pc_data);

The output should look something like…
printer name: 0x0
printer name: Some Name

Regards
Brenda